There are many functions in the Keras backend which have the keepdims
parameter. For instance
sum(x, axis=None, keepdims=False)
I can not find any explanation of what that means. Can someone explain what it does?
Also, what does it mean for axis
to be None
? Is it the same as saying axis = -1
?
These are not keras
specific parameters but numpy.sum
parameters.
axis : None or int or tuple of ints, optional
Axis or axes along which a sum is performed. The default (axis = None) is perform a sum over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis.
New in version 1.7.0.
If this is a tuple of ints, a sum is performed on multiple axes, instead of a single axis or all the axes as before.
keepdims : bool, optional
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original arr.
here is the source
You can find documentation and tutorial for theano (one of keras backends) in deeplearning.net
For method theano.tensor.sum
, see here
theano.tensor.sum(x, axis=None, dtype=None, keepdims=False, acc_dtype=None)
axis - axis or axes along which to compute the sum
keepdims - (boolean) If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original tensor.
As pointed out by EoinS, theano functions are very similar to those of numpy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With