size¶
- paddle.fluid.layers.nn. size ( input ) [source]
-
Size Layer
Returns the number of elements for a tensor, which is a int64 Tensor with shape [1].
- Parameters
-
input (Tensor) – The input Tensor, it’s data type can be bool, float16, float32, float64, int32, int64.
- Returns
-
The number of elements for the input Tensor.
- Return type
-
Tensor
- Raises
-
TypeError –
input
must be a Tensor and the data type ofinput
must be one of bool, float16, float32, float64, int32, int64.
Examples
import paddle import paddle.fluid.layers as layers paddle.enable_static() input = layers.data( name="input", shape=[3, 100], dtype="float32", append_batch_size=False) rank = layers.size(input) # 300