November 2017
Intermediate to advanced
274 pages
6h 16m
English
TensorFlow and Numpy are both N-dimensional array libraries. TensorFlow additionally allows us to create tensor functions and compute derivatives. TensorFlow has become one of the major libraries used for deep learning as it is incredibly efficient and can run on GPUs.
The following program describes how TensorFlow and numpy can be used to perform similar operations such as creating tensors of a (3,3) shape:
import TensorFlow as tfimport numpy as nptf.InteractiveSession()# TensorFlow operationsa = tf.zeros((3,3))b = tf.ones((3,3))print(tf.reduce_sum(b, reduction_indices=1).eval())print(a.get_shape())# numpy operationsa = np.zeros((3, 3))b = np.ones((3, 3))print(np.sum(b, axis=1)) print(a.shape)
The output ...
Read now
Unlock full access