Skip to content

Instantly share code, notes, and snippets.

View aijournal's full-sized avatar

AI Journal aijournal

View GitHub Profile
@aijournal
aijournal / performance.py
Created January 22, 2018 11:11
CPU/GPU perfrmance
import tensorflow as tf
import timeit
# See https://www.tensorflow.org/tutorials/using_gpu#allowing_gpu_memory_growth
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
with tf.device('/cpu:0'):
random_image_cpu = tf.random_normal((100, 100, 100, 3))
net_cpu = tf.layers.conv2d(random_image_cpu, 32, 7)
@aijournal
aijournal / gans.py
Created December 23, 2017 14:27
Code for Generative adversarial networks
from __future__ import print_function, division
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
get_ipython().run_line_magic('matplotlib', 'inline')
plt.rcParams['figure.figsize'] = (10.0, 8.0)
plt.rcParams['image.interpolation'] = 'nearest'
@aijournal
aijournal / utils.py
Created December 23, 2017 14:24
Utility file for Neural style transfer
import os
import sys
import scipy.io
import scipy.misc
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
from PIL import Image
from nst_utils import *
import numpy as np