Commit 53c4db69 authored by yselivonchyk's avatar yselivonchyk Committed by Yuxin Wu

Update utils.py (#616)

* Update utils.py

Example of deterministic weight initialization

* Update utils.py
parent 6ca57de4
...@@ -50,6 +50,19 @@ def fix_rng_seed(seed): ...@@ -50,6 +50,19 @@ def fix_rng_seed(seed):
Note: Note:
See https://github.com/ppwwyyxx/tensorpack/issues/196. See https://github.com/ppwwyyxx/tensorpack/issues/196.
Examples:
Fix random seed in both tensorpack and tensorflow.
.. code-block:: python
import tensorpack.utils.utils as utils
seed = 42
utils.fix_rng_seed(seed)
tesnorflow.set_random_seed(seed)
# run trainer
""" """
global _RNG_SEED global _RNG_SEED
_RNG_SEED = int(seed) _RNG_SEED = int(seed)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment