<jupyter_start><jupyter_text>Neurons in Tensorflow<jupyter_code>import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Initialise seeds<jupyter_code>np.random.seed(42)
tf.set_random_seed(42)<jupyter_output><empty_output><jupyter_text>Set Neurons<jupyter_code>n_input = 784
n_dense = 128<jupyter_output><empty_output><jupyter_text>Define Placeholder Tensor<jupyter_code>x = tf.placeholder(tf.float32, (1, n_input))<jupyter_output><empty_output><jupyter_text>Define Variable Tensors<jupyter_code>b = tf.Variable(tf.zeros([n_dense]))
# W = tf.Variable(tf.random_normal([n_input, n_dense]))
W = tf.get_variable("W", [n_input, n_dense], initializer = tf.contrib.layers.xavier_initializer())<jupyter_output><empty_output><jupyter_text>Designing the Compitational Graph<jupyter_code>z = tf.add(tf.matmul(x, W), b)
a1 = tf.sigmoid(z)
a2 = tf.tanh(z)
a3 = tf.nn.relu(z)<jupyter_output><empty_output><jupyter_text>Initialize Variables<jupyter_code>initializer_op = tf.global_variables_initializer()<jupyter_output><empty_output><jupyter_text>Execute Graph<jupyter_code>with tf.Session() as session:
    session.run(initializer_op)
    layer_output = session.run(a3, feed_dict = {x : np.random.random([1, n_input])})
layer_output
_ = plt.hist(np.transpose(layer_output))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13056163384390956, 'fraction_numerical': 0.01312910284463895, 'mean_word_length': 10.433333333333334, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '631878', 'license': 'MIT', 'n_tokens_mistral': 558, 'n_tokens_neox': 543, 'n_words': 66, 'path': 'notebooks/tensorflow/neurons-in-tensorflow.ipynb', 'repo_name': 'kiranvarghesev/DLinK', 'size': '1371'}