oneflow.Tensor.tolist

Tensor.tolist()

Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with item(). Tensors are automatically moved to the CPU first if necessary.

This operation is not differentiable.

Parameters

input (Tensor) – the input tensor.

For example:

>>> import oneflow as flow
>>> input = flow.tensor([[1,2,3], [4,5,6]])
>>> input.tolist()
[[1, 2, 3], [4, 5, 6]]