python - Convert a tensor to numpy array in Tensorflow ...
https://stackoverflow.com/questions/3409728103.12.2015 · import tensorflow as tf a = tf.constant ( [ [1, 2], [3, 4]]) b = tf.add (a, 1) a.numpy () # array ( [ [1, 2], # [3, 4]], dtype=int32) b.numpy () # array ( [ [2, 3], # [4, 5]], dtype=int32) tf.multiply (a, b).numpy () # array ( [ [ 2, 6], # [12, 20]], dtype=int32) See NumPy Compatibility for more. It is worth noting (from the docs),
python - TensorFlow: Max of a tensor along an axis - Stack ...
https://stackoverflow.com/questions/34987509By default it computes the global maximum of the given tensor, but you can specify a list of reduction_indices, which has the same meaning as axis in NumPy. To complete your example: x = tf.constant ( [ [1, 220, 55], [4, 3, -1]]) x_max = tf.reduce_max (x, reduction_indices= [1]) print sess.run (x_max) # ==> "array ( [220, 4], dtype=int32)"