- Pass numeric arguments as
tf.Tensor
objects (to avoid building new graphs and unnecessary retracing) - Beware of hidden side effects
- Pay attention to undefined values (special care with if/else statements and assymetric returns)
- Pay attention to lexical/dynamical scopes
- Do not create object attributes inside autographed functions (mutations lead to undefs)
- Avoid using Python lists; prefer tf.TensorArray
- To accumulate results from a dynamically unrolled loop, use
tf.TensorArray
- Use
tf.TensorSpec(shape=..., dtype=...)
ininput_signature
to avoid proliferation of graphs
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1' # ignore GPUs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
# http://phyletica.org/matplotlib-fonts/ | |
matplotlib.rcParams['pdf.fonttype'] = 42 | |
matplotlib.rcParams['ps.fonttype'] = 42 | |
matplotlib.rcParams['text.usetex'] = True | |
# https://nerdjusttyped.blogspot.com/2010/07/type-1-fonts-and-matplotlib-figures.html | |
matplotlib.rcParams['ps.useafm'] = True | |
matplotlib.rcParams['pdf.use14corefonts'] = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from setuptools import setup, find_packages | |
def read(filename): | |
filepath = os.path.join(os.path.dirname(__file__), filename) | |
file = open(filepath, 'r') | |
return file.read() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=g++ | |
CCFLAGS=-Wall -Wextra -ansi -pedantic -std=c++11 | |
CUDD=/usr/local/CUDD/cudd-3.0.0 | |
INCLUDE=-I$(CUDD)/cudd -I$(CUDD)/cplusplus | |
LIBS=$(CUDD)/cudd/.libs/libcudd.a | |
cudd: main.o | |
$(CC) -o $@ $^ $(LIBS) |