def sum(x, axis=None, keepdims=False):
"""Sum of the values in a tensor, alongside the specified axis.
"""
if axis is not None and axis < 0:
axis = axis % len(x.get_shape())
return tf.reduce_sum(x, reduction_indices=axis, keep_dims=keepdims)
def prod(x, axis=None, keepdims=False):
After Change
def sum(x, axis=None, keepdims=False):
"""Sum of the values in a tensor, alongside the specified axis.
"""
axis = normalize_axis(axis, ndim(x))
return tf.reduce_sum(x, reduction_indices=axis, keep_dims=keepdims)
def prod(x, axis=None, keepdims=False):