Best practices for generating a random seed to seed Pytorch?

username: pinocchio
cooked: <p>What I really want is to seed the dataset and dataloader. I am adapting code from:</p>
<aside class="onebox githubgist">
  <header class="source">
      <a href="https://gist.github.com/kevinzakka/d33bf8d6c7f06a9d8c76d97a7879f5cb" target="_blank" rel="nofollow noopener">gist.github.com</a>
  </header>
  <article class="onebox-body">
    <h4><a href="https://gist.github.com/kevinzakka/d33bf8d6c7f06a9d8c76d97a7879f5cb" target="_blank" rel="nofollow noopener">https://gist.github.com/kevinzakka/d33bf8d6c7f06a9d8c76d97a7879f5cb</a></h4>
<h5>data_loader.py</h5>
<pre><code class="Python">"""
Create train, valid, test iterators for CIFAR-10 [1].
Easily extended to MNIST, CIFAR-100 and Imagenet.

[1]: https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4
"""

import torch
import numpy as np
</code></pre>
This file has been truncated. <a href="https://gist.github.com/kevinzakka/d33bf8d6c7f06a9d8c76d97a7879f5cb" target="_blank" rel="nofollow noopener">show original</a>
<h5>utils.py</h5>
<pre><code class="Python">import matplotlib.pyplot as plt

label_names = [
    'airplane',
    'automobile',
    'bird',
    'cat',
    'deer',
    'dog',
    'frog',</code></pre>
This file has been truncated. <a href="https://gist.github.com/kevinzakka/d33bf8d6c7f06a9d8c76d97a7879f5cb" target="_blank" rel="nofollow noopener">show original</a>

<p>
</p>

  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>

<p>Anyone know how to seed this properly? What are the best practices for seeding things in Pytorch.</p>
<p>Honestly, I have no idea if there is an algorithm specific way for GPU vs CPU. I care mostly about general pytorch and make sure my code is “truly random”. Specially when it uses GPU I guess…</p>

username: pinocchio
cooked: <p>related:</p>
<ul>
<li><a href="https://discuss.pytorch.org/t/best-practices-for-seeding-random-numbers-on-gpu/18751" class="inline-onebox">Best practices for seeding random numbers on gpu?</a></li>
<li><a href="https://discuss.pytorch.org/t/the-random-seed/19516/4" class="inline-onebox">The Random Seed</a></li>
<li><a href="https://discuss.pytorch.org/t/best-practices-for-generating-a-random-seed-to-seed-pytorch/52894/2" class="inline-onebox">Best practices for generating a random seed to seed Pytorch?</a></li>
</ul>
<aside class="onebox stackexchange">
  <header class="source">
      <a href="https://stackoverflow.com/questions/57416925/best-practices-for-generating-a-random-seeds-to-seed-pytorch" target="_blank" rel="nofollow noopener">stackoverflow.com</a>
  </header>
  <article class="onebox-body">
      <a href="https://stackoverflow.com/users/3167448/pinocchio" target="_blank" rel="nofollow noopener">
    <img alt="Pinocchio" src="https://www.gravatar.com/avatar/ba92064b084638cb903cbd271120be64?s=128&amp;d=identicon&amp;r=PG&amp;f=1" class="thumbnail onebox-avatar" width="128" height="128">
  </a>
<h4>
  <a href="https://stackoverflow.com/questions/57416925/best-practices-for-generating-a-random-seeds-to-seed-pytorch" target="_blank" rel="nofollow noopener">Best practices for generating a random seeds to seed Pytorch?</a>
</h4>

<div class="tags">
  <strong>pytorch</strong>
</div>

<div class="date">
  asked by
  
  <a href="https://stackoverflow.com/users/3167448/pinocchio" target="_blank" rel="nofollow noopener">
    Pinocchio
  </a>
  on <a href="https://stackoverflow.com/questions/57416925/best-practices-for-generating-a-random-seeds-to-seed-pytorch" target="_blank" rel="nofollow noopener">04:20PM - 08 Aug 19 UTC</a>
</div>

  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>