mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-10 07:28:15 -05:00
update doc of Tensor.tolist (#9016)
it returns single value for const tensor
This commit is contained in:
@@ -334,11 +334,16 @@ class Tensor(SimpleMathTrait):
|
||||
def tolist(self) -> Union[Sequence[ConstType], ConstType]:
|
||||
"""
|
||||
Returns the value of this tensor as a nested list.
|
||||
Returns single value for const tensor.
|
||||
|
||||
```python exec="true" source="above" session="tensor" result="python"
|
||||
t = Tensor([1, 2, 3, 4])
|
||||
print(t.tolist())
|
||||
```
|
||||
```python exec="true" source="above" session="tensor" result="python"
|
||||
t = Tensor(5)
|
||||
print(t.tolist())
|
||||
```
|
||||
"""
|
||||
return self.data().tolist()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user