Operations

Operations are nodes that represent mathematical operations over the tensors on a graph. These operations can be any kind of functions, like add and subtract tensors, or maybe an activation function.

tf.matmul, tf.add, and  tf.nn.sigmoid are some of the operations in TensorFlow. These are like functions in Python, but operate directly over tensors and each one does a specific thing.

Other operations can be easily found at: https://www.tensorflow.org/api_guides/python/math_ops.

Let's play around with some of these operations:

a = tf.constant([5])
b = tf.constant([2])
c = tf.add(a,b)
d = tf.subtract(a,b)
with tf.Session() as session:
result = session.run(c)
print 'c =: %s' % result
result = session.run(d)
print 'd =: %s' % result
Output:
c =: [7]
d =: [3]

tf.nn.sigmoid is an activation function: it's a little more complicated, but this function helps learning models to evaluate what kind of information is good or not good.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset