mirror of https://github.com/commaai/tinygrad.git
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
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
## Creation (random)
|
## Creation (random)
|
||||||
|
|
||||||
|
::: tinygrad.Tensor.manual_seed
|
||||||
::: tinygrad.Tensor.rand
|
::: tinygrad.Tensor.rand
|
||||||
::: tinygrad.Tensor.randn
|
::: tinygrad.Tensor.randn
|
||||||
::: tinygrad.Tensor.randint
|
::: tinygrad.Tensor.randint
|
||||||
|
|
|
@ -372,7 +372,13 @@ class Tensor:
|
||||||
|
|
||||||
```python exec="true" source="above" session="tensor" result="python"
|
```python exec="true" source="above" session="tensor" result="python"
|
||||||
Tensor.manual_seed(42)
|
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)
|
Tensor._seed, Tensor._rng_counter = seed, Tensor([0], dtype=dtypes.uint32, requires_grad=False)
|
||||||
|
|
Loading…
Reference in New Issue