In this article, I will share some of my experience on installing NVIDIA driver and CUDA on Linux OS. Here I mainly use Ubuntu as example. Comments for CentOS/Fedora are also provided as much as I can.
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)) | |
import numpy as np | |
import tensorflow as tf | |
# Newton's optimization method for multivariate function in tensorflow | |
def cons(x): | |
return tf.constant(x, dtype=tf.float32) | |
def compute_hessian(fn, vars): | |
mat = [] |
# | |
# mnist_cnn_bn.py date. 5/21/2016 | |
# date. 6/2/2017 check TF 1.1 compatibility | |
# | |
from __future__ import absolute_import | |
from __future__ import division | |
from __future__ import print_function | |
import os |
Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.
The basic idea is that C:\Program Files\Git\mingw64\
is your /
directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git
, the mingw64
in this directory is your root. Find it by using pwd -W
).
If you go to that directory, you will find the typical linux root folder structure (bin
, etc
, lib
and so on).
If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so
- Download Franz for your distribution from MeetFranz.com
- change into the same directory as the downloaded file, then
sudo tar -xf Franz-linux-x64-0.9.10.tgz -C /opt/franz
- (optional)
wget "https://cdn-images-1.medium.com/max/360/1*v86tTomtFZIdqzMNpvwIZw.png" -O franz-icon.png
thensudo cp franz-icon.png /opt/franz
- (optional)
sudo touch /usr/share/applications/franz.desktop
thensudo vim /usr/share/applications/franz.desktop
paste the following lines into the file, then save the file:
[Desktop Entry]
Name=Franz
Comment=
import os | |
import fnmatch | |
def recursive_glob(rootdir='.', pattern='*'): | |
"""Search recursively for files matching a specified pattern. | |
Adapted from http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python | |
""" | |
matches = [] |
# 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 |
This gist has been superceded by Meta Graph functionality that has since been added to tensorflow core.
The code remains posted for archival purposes only.
A comparison of Theano with other deep learning frameworks, highlighting a series of low-level design choices in no particular order.
Overview
Symbolic: Theano, CGT; Automatic: Torch, MXNet
Symbolic and automatic differentiation are often confused or used interchangeably, although their implementations are significantly different.