mygrad.Tensor.item#
- Tensor.item() int | float[source]#
 Copy an element of a tensor to a standard Python scalar and return it.
Note that the returned object does not support back-propagation.
- Returns:
 - zStandard Python scalar object
 A copy of the specified element of the tensor as a suitable Python scalar
Examples
>>> import mygrad as mg >>> x = Tensor([22.2]) >>> x.item() 22.2 >>> type(x.item()) float