Skip to content

Instantly share code, notes, and snippets.

# from https://stackoverflow.com/questions/30755249/hierarchy-in-matplotlib
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
subplot_args = {'projection':'3d'}
fig, ax = plt.subplots(subplot_kw=subplot_args)
run_meta = tf.RunMetadata()
with tf.Session(config=config) as sess:
opts = tf.profiler.ProfileOptionBuilder.float_operation()
flops = tf.profiler.profile(sess.graph, run_meta=run_meta, cmd='op', options=opts)
opts = tf.profiler.ProfileOptionBuilder.trainable_variables_parameter()
params = tf.profiler.profile(sess.graph, run_meta=run_meta, cmd='op', options=opts)
print("ops {:,} --- params {:,}".format(flops.total_float_ops, params.total_parameters))
use "-undefined dynamic_lookup" instead of "-lpython"
use "-Xpreprocessor -fopenmp -lomp" instead of "-fopenmp"
flags to be added for lpython: "-L/usr/local/opt/libomp/lib -I/usr/include/python2.7" ?
get numpy include dir: np.get_include()