import tensorflow as tf
from tensorflow.python.framework import ops
import numpy as np
# Define custom py_func which takes also a grad op as argument:
def py_func(func, inp, Tout, stateful=True, name=None, grad=None):
# Need to generate a unique name to avoid duplicates:
rnd_name = 'PyFuncGrad' + str(np.random.randint(0, 1E+8))
View minmaxabssign.txt
max(-x,-y) = -min(x,y)
min(-x,-y) = -max(x,y)
abs(x) = abs(-x)
abs(x) = max(x,-x) = -min(x,-x)
abs(x*a) = if (a >= 0) abs(x)*a
(a < 0) -abs(x)*a
// basically any commutative operation
min(x,y) + max(x,y) = x + y

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

View kmeans.pyx
Parallelized k-means module.
By David Warde-Farley, February 2012. Licensed under the 3-clause BSD.
cimport cython
from cython.parallel import prange
import numpy as np
cimport numpy as np
from numpy.random import normal