Skip to content

Instantly share code, notes, and snippets.

View wangleiphy's full-sized avatar

Lei Wang wangleiphy

View GitHub Profile
@tobin
tobin / hk.c
Last active September 10, 2022 21:53
Hoshen-Kopelman algorithm for cluster labeling
/* Tobin Fricke's implementation of the
Hoshen-Kopelman algorithm for
cluster labeling.
Copyright (c) September 9, 2000, by Tobin Fricke <fricke@gmail.com>
Modified 2002-03-09 Tobin Fricke
Modified substantially 2004-04-21 by Tobin Fricke
This program is written in the 1999 standard of the C language (C99). Older C
@fperez
fperez / SimpleNeuralNets.ipynb
Last active April 19, 2022 18:52
Notes for "Why does deep and cheap learning work so well?" (ArXiv:1608.08225v1/cond-mat.dis-nn) by Lin and Tegmark.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ASvyatkovskiy
ASvyatkovskiy / gpuarray_allreduce_test.py
Created August 29, 2017 03:14
Test CUDA-aware mpi4py with pycuda gpuarrays
#!/usr/bin/env python
from mpi4py import MPI
import numpy as np
import time
import pycuda.autoinit
from pycuda import gpuarray
comm = MPI.COMM_WORLD
comm_rank = comm.Get_rank()
@timvieira
timvieira / lagrangeprop.py
Last active May 1, 2022 06:54
Automatic differentiation as the method of Lagrange multipliers. Code accompanies this blog post: http://timvieira.github.io/blog/post/2017/08/18/backprop-is-not-just-the-chain-rule/
# -*- coding: utf-8 -*-
"""
Backprop as the method of Lagrange multiplers (and even the implicit function
theorem).
"""
from __future__ import division
import numpy as np
from arsenal.alphabet import Alphabet
from arsenal.math.checkgrad import finite_difference
@giuseppebonaccorso
giuseppebonaccorso / fim.py
Created September 2, 2017 15:02
Fisher Information Matrix
import numpy as np
import tensorflow as tf
from sklearn.datasets import make_blobs
# Set random seed (for reproducibility)
np.random.seed(1000)
# Create dataset
nb_samples=2000
@lirnli
lirnli / Simple Dilation Network.ipynb
Last active October 24, 2022 10:50
Simple Dilation Network to generate sine waves
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lirnli
lirnli / Pytorch Wavenet.ipynb
Created October 16, 2017 10:51
Pytorch Wavenet
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yaroslavvb
yaroslavvb / kfac_small_pytorch_test.py
Created October 19, 2017 15:23
toy example of KFAC in pytorch
# Times: min: 440.60, median: 452.39, mean: 453.87
import util as u
u.check_mkl()
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
@guillefix
guillefix / lc.py
Last active May 10, 2020 14:00
temporal workaround to get Conv2dLocal to work in PyTorch
# coding: utf-8
# In[1]:
import math
import torch
from torch.nn.parameter import Parameter
import torch.nn.functional as F