qml.math.shape

shape(tensor)[source]

Returns the shape of the tensor.

Parameters

tensor (tensor_like) – input tensor

Returns

shape of the tensor

Return type

tuple[int]

Example

>>> x = tf.constant([[0.6, 0.1, 0.6], [1., 2., 3.]])
>>> shape(x)
(2, 3)