Kevin Kevin - 3 months ago 54
Python Question

What is the equivalent of np.std() in TensorFlow?

Just looking for the equivalent of np.std() in TensorFlow to calculate the standard deviation of a tensor.

Answer

To get the mean and variance just use tf.nn.moments.

mean, var = tf.nn.moments(x,axes=[1])

for more on tf.nn.moments params see docs