is_tensor

paddle. is_tensor ( x ) [source]

Tests whether input object is a paddle.Tensor.

Parameters

x (object) – Object to test.

Returns

A boolean value. True if x is a paddle.Tensor, otherwise False.

Examples

import paddle

input1 = paddle.rand(shape=[2, 3, 5], dtype='float32')
check = paddle.is_tensor(input1)
print(check)  #True

input3 = [1, 4]
check = paddle.is_tensor(input3)
print(check)  #False