is_empty¶
- paddle. is_empty ( x, name=None ) [source]
-
Test whether a Tensor is empty.
- Parameters
-
x (Tensor) – The Tensor to be tested.
name (str, optional) – The default value is
None
. Normally users don’t have to set this parameter. For more information, please refer to Name .
- Returns
-
A bool scalar Tensor. True if ‘x’ is an empty Tensor.
- Return type
-
Tensor
Examples
import paddle input = paddle.rand(shape=[4, 32, 32], dtype='float32') res = paddle.is_empty(x=input) print("res:", res) # ('res:', Tensor: eager_tmp_1 # - place: CPUPlace # - shape: [1] # - layout: NCHW # - dtype: bool # - data: [0])