This file contains 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 tensorflow as tf | |
import numpy as np | |
# Parameters | |
learning_rate = 0.001 | |
decay=.9 | |
training_epochs = 15 | |
batch_size = 100 | |
display_step = 100 |
This file contains 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 numpy as np | |
from skimage.util import view_as_blocks | |
def round_down(num, divisor): | |
return num - (num % divisor) | |
def crop_center(img, new_rows, new_cols): | |
rows, cols, c = img.shape |
This file contains 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 tensorflow as tf | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from tensorflow.examples.tutorials.mnist import input_data | |
""" | |
Utilities | |
""" | |
def orthogonal_initializer(scale=1.1): | |
''' From Lasagne and Keras. Reference: Saxe et al., http://arxiv.org/abs/1312.6120 |
This file contains 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 tensorflow as tf | |
from tensorflow.models.rnn import rnn_cell | |
from tensorflow.python.framework import dtypes | |
from tensorflow.python.ops import variable_scope as vs | |
from tensorflow.python.ops.math_ops import sigmoid, tanh | |
import numpy as np | |
def softmax(x): | |
e_x = np.exp(x - x.max(axis=1)[:, None]) |