Skip to content

Instantly share code, notes, and snippets.

View wohlert's full-sized avatar

Jesper Wohlert wohlert

View GitHub Profile
@wohlert
wohlert / baselayer.py
Last active May 24, 2019 15:45
A metaprogramming approach with minimal overhead to perform Jacobian computation for arbitrary networks
View baselayer.py
"""
Registers jacobian for basic PyTorch layers
"""
import torch
from torch import nn
from .metric import register_jacobian
@register_jacobian(nn.Linear)
@wohlert
wohlert / Sinkhorn-solver.ipynb
Created April 3, 2019 11:43
Sinkhorn solver in PyTorch
View Sinkhorn-solver.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wohlert
wohlert / hmc.py
Created June 22, 2018 13:12
Hamiltonian Monte Carlo
View hmc.py
import numpy as np
class HamiltonianMC(object):
"""
Hamiltonian/hybrid Monte Carlo
Uses Hamiltonian dynamics to make proposals using
kinetic energy of the proposal. Employs leapfrog
integration for time-reversibility and to ensure
@wohlert
wohlert / Backpropagation.ipynb
Last active October 30, 2018 15:58
Tutorial describing backpropagation in a MLP
View Backpropagation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.