<jupyter_start><jupyter_text>Variables and Placeholders<jupyter_code>import tensorflow as tf
sess = tf.InteractiveSession()<jupyter_output><empty_output><jupyter_text>Variables<jupyter_code># 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)
my_tensor
# Initialize the tensor as a Variable
my_var = tf.Variable(initial_value = my_tensor)
my_var<jupyter_output><empty_output><jupyter_text>Note! You must initialize all global variables!<jupyter_code># OBLIGATORY!
# Initializing all variables
init = tf.global_variables_initializer()
init.run()
my_var.eval()
sess.run(my_var)<jupyter_output><empty_output><jupyter_text>Placeholders<jupyter_code># Defining a Plaholder of a specific type
ph = tf.placeholder(tf.float64)
ph = tf.placeholder(tf.int32)
# 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 )<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09050576752440107, 'fraction_numerical': 0.011535048802129548, 'mean_word_length': 4.5024390243902435, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '149328', 'license': 'Apache-2.0', 'n_tokens_mistral': 376, 'n_tokens_neox': 362, 'n_words': 93, 'path': '18-05-28-Complete-Guide-to-Tensorflow-for-Deep-Learning-with-Python/02-Tensorflow-Basics/02-Variables-and-Placeholders.ipynb', 'repo_name': 'maraboinavamshi/courses', 'size': '1127'}