In [1]:
import tensorflow as tf
In [2]:
sess = tf.InteractiveSession()
In [3]:
# Create a tensor of shape 4 by 4 with uniformly distributed random values
my_tensor = tf.random_uniform(shape = (4,4),
minval = 0,
maxval = 1)
In [4]:
my_tensor
Out[4]:
In [5]:
# Initialize the tensor as a Variable
my_var = tf.Variable(initial_value = my_tensor)
In [6]:
my_var
Out[6]:
In [7]:
# OBLIGATORY!
# Initializing all variables
init = tf.global_variables_initializer()
In [8]:
init.run()
In [9]:
my_var.eval()
Out[9]:
In [10]:
sess.run(my_var)
Out[10]:
In [11]:
# Defining a Plaholder of a specific type
ph = tf.placeholder(tf.float64)
In [12]:
ph = tf.placeholder(tf.int32)
In [13]:
# For shape its common to use (None, Numbers of Features)
# because None can be filled by number of samples in data
ph = tf.placeholder(shape = (None, 5),
dtype = tf.float32 )
Coming up next is where we'll put this all together!