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
# DRAW implementation | |
class draw_model(): | |
def __init__(self): | |
# First we download the MNIST dataset into our local machine. | |
self.mnist = input_data.read_data_sets("data/", one_hot=True) | |
print "------------------------------------" | |
print "MNIST Dataset Succesufully Imported" | |
print "------------------------------------" | |
self.n_samples = self.mnist.train.num_examples |
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
# fully-conected layer | |
def dense(x, inputFeatures, outputFeatures, scope=None, with_w=False): | |
with tf.variable_scope(scope or "Linear"): | |
matrix = tf.get_variable("Matrix", [inputFeatures, outputFeatures], tf.float32, tf.random_normal_initializer(stddev=0.02)) | |
bias = tf.get_variable("bias", [outputFeatures], initializer=tf.constant_initializer(0.0)) | |
if with_w: | |
return tf.matmul(x, matrix) + bias, matrix, bias | |
else: | |
return tf.matmul(x, matrix) + bias |
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
# first we import our libraries | |
import tensorflow as tf | |
from tensorflow.examples.tutorials import mnist | |
from tensorflow.examples.tutorials.mnist import input_data | |
import numpy as np | |
import scipy.misc | |
import os |