sadakmed
(sadak)
#1
I just set torch seed to 0 with `torch.manual_seed`

, Is there any way to reset the seed.

my case was, I wanted to generate a fixed random tensor, without affecting the randomness of others(other tensors should be different each time).

I found a context manager in `torchfunc`

module, but I don’t have access to it in HuggingFace

sharvil
(Sharvil Nanavati)
#2
You can use `torch.random.get_rng_state()`

and `torch.random.set_rng_state(prev_state)`

. See torch.random — PyTorch 1.7.0 documentation for docs.

Another option is to use NumPy to generate your random fixed tensor.

```
np.random.seed(0)
random_fixed_tensor = torch.as_tensor(np.random.normal(...))
```