Skip to content

Instantly share code, notes, and snippets.

Luca Antiga lantiga

Block or report user

Report or block lantiga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lantiga
lantiga / cyclegan.py
Last active Feb 6, 2018
CycleGAN pretrained
View cyclegan.py
import torch
import torch.nn as nn
class ResnetBlock(nn.Module):
def __init__(self, dim):
super(ResnetBlock, self).__init__()
self.conv_block = self.build_conv_block(dim)
@lantiga
lantiga / README.md
Created Feb 6, 2018
Indexed convolution
View README.md

Indexed convolutions

A convolution operator over a 1D tensor (BxCxL), where a list of neighbors for each element is provided through a indices tensor (LxK), where K is the size of the convolution kernel. Each row of indices specifies the indices of the K neighbors of the corresponding element in the input. A -1 is handled like for zero padding.

Note that the neighbors specified in indices are not relative, but rather absolute. They have to be specified for each of the elements of the output.

A use case is for convolutions over non-square lattices, such as images on hexagonal lattices coming from Cherenkov telescopes (http://www.isdc.unige.ch/%7Elyard/FirstLight/FirstLight_slowHD.mov).

Example:

@lantiga
lantiga / tracing_blocks.py
Created Sep 11, 2017
PyTorch namespaces tests
View tracing_blocks.py
import torch
import torch.nn as nn
from torch.autograd import Variable
from graphviz import Digraph
def name(node, annotation=None):
kind = node.kind()
@lantiga
lantiga / vmtk.rb
Created Jun 10, 2017
Brew formula for vmtk 1.3.2
View vmtk.rb
class Vmtk < Formula
desc "The Vascular Modeling Toolkit"
homepage "http://www.vmtk.org"
url "https://github.com/vmtk/vmtk/archive/v1.3.2.tar.gz"
version "1.3.2"
sha256 "2632a74341605bd3ddd97971fad70941329e77a112f9363bc5053a1e2ba7c30e"
head "https://github.com/vmtk/vmtk.git"
revision 1
# bottle do
View gist:0e4ec0297a4c54bc0ec1
### Keybase proof
I hereby claim:
* I am lantiga on github.
* I am lantiga (https://keybase.io/lantiga) on keybase.
* I have a public key whose fingerprint is C364 40F7 E6D0 2B02 AF9C FC34 BE4B 71AA 57A8 4B6A
To claim this, I am signing this object:
@lantiga
lantiga / core.clj
Last active Aug 29, 2015
Naive pure rule engine
View core.clj
(ns carla.core
(:require [clojure.math.combinatorics :as combo]))
(defn- fact-matches? [fact match]
(= match (select-keys fact (keys match))))
(defn make-rules [] [])
(defn make-session [] {:facts #{}})
@lantiga
lantiga / state.ki.js
Last active Jul 21, 2019
State management in ki (http://ki-lang.org)
View state.ki.js
ki macro (export $name $val)
(js exports.$name = $val)
ki require core
// Ported from https://github.com/clojure/clojurescript/blob/master/src/cljs/clojure/data.cljs
ki (ns diff
View react_ki
ki -o react_ki.out.js react_ki.js
View core.clj
(ns asyncatom.core
(:require [clojure.core.async :refer [chan go <! >! <!!]])
(:refer-clojure :exclude [atom swap! reset! compare-and-set! deref]))
(defn atom [v]
(let [c (chan)]
(go
(loop [v v]
(let [[cmd oc & args] (<! c)
v (condp = cmd
@lantiga
lantiga / archimedes-test.project.clj
Last active May 24, 2016
Working setup and sample Clojure code for Archimedes and Ogre (http://clojurewerkz.org/) on OrientDB 1.3 (http://orientdb.org/) via Blueprints (https://github.com/tinkerpop/blueprints/wiki).
View archimedes-test.project.clj
(defproject archimedes-test "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[com.orientechnologies/orient-commons "1.3.0"]
[com.orientechnologies/orientdb-core "1.3.0"]
[com.tinkerpop.blueprints/blueprints-orient-graph "2.3.0"]
[clojurewerkz/ogre "2.3.0.1"]
You can’t perform that action at this time.