# Fixing seeds affects performance?

**URL:** <https://discuss.pytorch.org/t/fixing-seeds-affects-performance/217176>\
**Category:** autograd\
**Created:** [February 26, 2025, 9:47am UTC](https://discuss.pytorch.org/t/fixing-seeds-affects-performance/217176 "2025-02-26T09:47:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![iliasslasri](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/i/67e7ee/32.png) [@iliasslasri](https://discuss.pytorch.org/u/iliasslasri)\
**Post date:** [February 26, 2025, 9:47am UTC](https://discuss.pytorch.org/t/fixing-seeds-affects-performance/217176/1 "2025-02-26T09:47:31Z")

</div>

Hey all,  
Referring to topics like [How could I fix the random seed absolutely](https://discuss.pytorch.org/t/how-could-i-fix-the-random-seed-absolutely/45515). I couldn’t find any resources talking about the effects of fixing all seeds and going`torch.backends.cudnn.enabled=False torch.backends.cudnn.deterministic=True`. Does this affect performance of training at all ?

```auto
import torch
import torch.nn as nn
import numpy as np
import random
import my_model
import my_dataset

torch.manual_seed(123)
torch.cuda.manual_seed(123)
np.ranom.seed(123)
random.seed(123)
torch.backends.cudnn.enabled=False
torch.backends.cudnn.deterministic=True

def train():
...

if __name__ == ' __main__':
    train()

```

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [February 26, 2025, 5:48pm UTC](https://discuss.pytorch.org/t/fixing-seeds-affects-performance/217176/2 "2025-02-26T17:48:56Z")

</div>

> [@iliasslasri](#):
>
> Does this affect performance of training at all ?

I assume performance means training speed here. Yes, disabling cuDNN or selecting deterministic algorithms could slow down your code.
