mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
doc: manual_seed (#4987)
there was a docstring just not linked to the doc page. also updated the example to show re-seed instead of a internal variable
This commit is contained in:
parent
ce1ed374c9
commit
20b50d8d64
2 changed files with 8 additions and 1 deletions
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
## Creation (random)
|
||||
|
||||
::: tinygrad.Tensor.manual_seed
|
||||
::: tinygrad.Tensor.rand
|
||||
::: tinygrad.Tensor.randn
|
||||
::: tinygrad.Tensor.randint
|
||||
|
|
|
|||
|
|
@ -372,7 +372,13 @@ class Tensor:
|
|||
|
||||
```python exec="true" source="above" session="tensor" result="python"
|
||||
Tensor.manual_seed(42)
|
||||
print(Tensor._seed)
|
||||
print(Tensor.rand(5).numpy())
|
||||
print(Tensor.rand(5).numpy())
|
||||
```
|
||||
```python exec="true" source="above" session="tensor" result="python"
|
||||
Tensor.manual_seed(42) # reset to the same seed
|
||||
print(Tensor.rand(5).numpy())
|
||||
print(Tensor.rand(5).numpy())
|
||||
```
|
||||
"""
|
||||
Tensor._seed, Tensor._rng_counter = seed, Tensor([0], dtype=dtypes.uint32, requires_grad=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue