Skip to content

Instantly share code, notes, and snippets.

@Piyush3dB
Piyush3dB / test_winograd.py
Created July 4, 2016 13:51
Simple example to demonstrate winograd convolution transformations
# Imports
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
import pdb as pdb
from scipy import ndimage as nd
from scipy import signal
@Piyush3dB
Piyush3dB / persistentCursor.py
Created June 17, 2016 12:22
Perisitent python cursor
import time
import sys
print 'hello',
sys.stdout.flush()
time.sleep(1)
@Piyush3dB
Piyush3dB / matconvnet_setup.txt
Created June 5, 2016 08:15
matconvnet matlab setup
git clone https://github.com/vlfeat/matconvnet.git
cd matconvnet/matlab
run vl_setupnn
run vl_compilenn('enableGpu', true)
run vl_testnn('gpu', true)
@Piyush3dB
Piyush3dB / linear_regression_simple.py
Created May 31, 2016 20:31
MXNet simple example of MLP with 30 output lnear regression.
import find_mxnet
import mxnet as mx
from load_data import load
from sklearn.cross_validation import train_test_split
import logging
import pdb as pdb
import numpy as np
import matplotlib.pyplot as plt
@Piyush3dB
Piyush3dB / MXNet-ops.txt
Created May 31, 2016 10:47
List of MXNet operators
grep MXNET_REGISTER_OP_PROPERTY . -R
./src/operator/cross_device_copy.cc: MXNET_REGISTER_OP_PROPERTY(_CrossDeviceCopy, CrossDeviceCopyProp)
./src/operator/convolution.cc: MXNET_REGISTER_OP_PROPERTY(Convolution, ConvolutionProp)
./src/operator/elementwise_sum.cc: MXNET_REGISTER_OP_PROPERTY(ElementWiseSum, ElementWiseSumProp)
./src/operator/activation.cc: MXNET_REGISTER_OP_PROPERTY(Activation, ActivationProp)
./src/operator/reshape.cc: MXNET_REGISTER_OP_PROPERTY(Reshape, ReshapeProp)
./src/operator/reshape.cc: MXNET_REGISTER_OP_PROPERTY(Flatten, FlattenProp)
./src/operator/fully_connected.cc: MXNET_REGISTER_OP_PROPERTY(FullyConnected, FullyConnectedProp)
./src/operator/softmax_output.cc: MXNET_REGISTER_OP_PROPERTY(SoftmaxOutput, SoftmaxOutputProp)
./src/operator/softmax_output.cc: MXNET_REGISTER_OP_PROPERTY(Softmax, DeprecatedSoftmaxProp)
import numpy as np
import pdb as pdb
def batchnorm_forward(x, gamma, beta, eps):
N, D = x.shape
#step1: calciulate mean
import numpy as np
import pdb as pdb
np.random.seed(0)
b = 5
h = 10
m = 3
# forward pass
W = np.random.randn(b, h)
@Piyush3dB
Piyush3dB / closures.swift
Created April 16, 2016 11:08
Swift playground for closures
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
//
// Closure basicsg
//
@Piyush3dB
Piyush3dB / Makefile
Last active April 5, 2016 21:25
MXNet amalgamation makefile that works.
# 1. Generate .d file
g++ -std=c++11 -I`pwd`/../../OpenBLAS/installed/lib -MD -MF mxnet_predict0.d -I `pwd`/../ -I `pwd`/../mshadow/ -I `pwd`/../dmlc-core/include -I `pwd`/../include -c mxnet_predict0.cc
rm mxnet_predict0.o
# 2. Run python script
Generating amalgamation to mxnet_predict-all.cc
python ./amalgamation.py mxnet_predict0.d mxnet_predict0.cc mxnet_predict-all.cc 0
Not processed: mxnet_predict0.o:
# 3. Compile amalgamate code
@Piyush3dB
Piyush3dB / pyuvFileFormat.txt
Created March 29, 2016 12:24
PYUV file format parameter setup
For automatic parameter setup, the filename must contain the following tokens, in any order.
whatever_widthxheight_rateHz_precb_format.yuv
width = integer number, the frame width in pixel
height = integer number, the frame height in pixel
rate = real number, the frames per second to be rendered