Skip to content

Instantly share code, notes, and snippets.

View sunsided's full-sized avatar
🇺🇦
#StandWithUkraine

Markus Mayer sunsided

🇺🇦
#StandWithUkraine
View GitHub Profile
@sunsided
sunsided / SIMDStarterKit.h
Created April 11, 2017 23:55 — forked from jackmott/SIMDStarterKit.h
A header file to make SIMD intrinsics a bit easier to work with
// A header file to get you set going with Intel SIMD instrinsic programming.
// All necessary header files are inlucded for SSE2, SSE41, and AVX2
// Macros make the intrinsics easier to read and generic so you can compile to
// SSE2 or AVX2 with the flip of a #define
#define SSE2 //indicates we want SSE2
#define SSE41 //indicates we want SSE4.1 instructions (floor and blend is available)
#define AVX2 //indicates we want AVX2 instructions (double speed!)
@sunsided
sunsided / load_jpeg_with_tensorflow.py
Created April 4, 2017 16:39 — forked from eerwitt/load_jpeg_with_tensorflow.py
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# Typical setup to include TensorFlow.
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./images/*.jpg"))
# Read an entire image file which is required since they're JPEGs, if the images
# are too large they could be split in advance to smaller files or use the Fixed
@sunsided
sunsided / keybase.md
Created February 9, 2017 23:23
Keybase identity proof

Keybase proof

I hereby claim:

  • I am sunsided on github.
  • I am sunside (https://keybase.io/sunside) on keybase.
  • I have a public key whose fingerprint is 808E 4A07 72DF 6180 5D0F F445 5A01 1B8A 8E78 85DC

To claim this, I am signing this object:

@sunsided
sunsided / numpy_Capi
Created February 2, 2017 20:47 — forked from jjlin18/numpy_Capi
sample code for get and return numpy in C++
// From http://stackoverflow.com/questions/9128519/reading-many-values-from-numpy-c-api
/*
Make
g++ -o matrix_multiply.o -c matrix_multiply.cpp -I{python include file for numpy/noprefix.h} -I{python include} -fPIC -O2 -Wno-deprecated -Wno-write-strings
g++ -o matrix_multiply.so -shared matrix_multiply.o -L{boost lib path} -lz -lm -ldl -lpthread -boost_python
Python code:
import numpy
import matrix_multiply
@sunsided
sunsided / autoencoder.py
Created January 24, 2017 14:38 — forked from saliksyed/autoencoder.py
Tensorflow Auto-Encoder Implementation
""" Deep Auto-Encoder implementation
An auto-encoder works as follows:
Data of dimension k is reduced to a lower dimension j using a matrix multiplication:
softmax(W*x + b) = x'
where W is matrix from R^k --> R^j
A reconstruction matrix W' maps back from R^j --> R^k
@sunsided
sunsided / pca_alt_min.py
Created January 24, 2017 12:46 — forked from ahwillia/pca_alt_min.py
Alternating Minimization in Tensorflow (PCA example)
import numpy as np
import tensorflow as tf
# N, size of matrix. R, rank of data
N = 100
R = 5
# generate data
W_true = np.random.randn(N,R)
C_true = np.random.randn(R,N)
@sunsided
sunsided / tensorflow_pca.py
Created January 24, 2017 12:46 — forked from ahwillia/tensorflow_pca.py
PCA in TensorFlow
import numpy as np
import tensorflow as tf
# N, size of matrix. R, rank of data
N = 100
R = 5
# generate data
W_true = np.random.randn(N,R)
C_true = np.random.randn(R,N)
@sunsided
sunsided / memdjpeg.c
Created January 19, 2017 15:52 — forked from PhirePhly/memdjpeg.c
A bare-bones example of how to use jpeglib to decompress a jpg in memory.
// memdjpeg - A super simple example of how to decode a jpeg in memory
// Kenneth Finnegan, 2012
// blog.thelifeofkenneth.com
//
// After installing jpeglib, compile with:
// cc memdjpeg.c -ljpeg -o memdjpeg
//
// Run with:
// ./memdjpeg filename.jpg
//
@sunsided
sunsided / t-SNE Tutorial.ipynb
Created January 11, 2017 16:03 — forked from awjuliani/t-SNE Tutorial.ipynb
A notebook describing how to use t-SNE to visualize a neural network learn representations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sunsided
sunsided / execfile.py
Created January 6, 2017 14:23
Fix for execfile missing in Python 3
def execfile(filename, globals=None, locals=None):
# http://stackoverflow.com/a/6357418/195651
exec(compile(open(filename, "rb").read(), filename, 'exec'), globals, locals)