You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/02/28 01:47:25 UTC
[GitHub] CoinCheung opened a new issue #9909: mx.random.seed(seed) does not work for mx.io.ImageRecordIter() ?
CoinCheung opened a new issue #9909: mx.random.seed(seed) does not work for mx.io.ImageRecordIter() ?
URL: https://github.com/apache/incubator-mxnet/issues/9909
## Description
The random seed of mx.io.ImageRecordIter() cannot be changed with mx.random.seed(seed).
## Environment info (Required)
```
Version : 3.6.4
Compiler : GCC 7.2.1 20171224
Build : ('default', 'Jan 5 2018 02:35:40')
Arch : ('64bit', '')
------------Pip Info-----------
Version : 9.0.1
Directory : /usr/lib/python3.6/site-packages/pip
----------MXNet Info-----------
Version : 1.1.0
Directory : /home/coin/.local/lib/python3.6/site-packages/mxnet
Commit Hash : 07a83a0325a3d782513a04f47d711710972cb144
----------System Info----------
Platform : Linux-4.14.15-1-ARCH-x86_64-with-arch
system : Linux
node : Arch-R720
release : 4.14.15-1-ARCH
version : #1 SMP PREEMPT Tue Jan 23 21:49:25 UTC 2018
----------Hardware Info----------
machine : x86_64
processor :
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 158
Model name: Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
Stepping: 9
CPU MHz: 900.142
CPU max MHz: 3500.0000
CPU min MHz: 800.0000
BogoMIPS: 4993.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti retpoline rsb_ctxsw tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
```
Package used (Python/R/Scala/Julia):
(I'm using python)
## Minimum reproducible example
(If you are using your own code, please provide a short script that reproduces the error. Otherwise, please provide link to the existing example.)
```
import mxnet as mx
import core.io as io
import random
seed = 1
data_record='./datasets/train_list.rec'
shape=(3,30,100)
label_width=4
batch_size=128
dataiter = mx.io.ImageRecordIter(
path_imgrec=data_record,
data_shape=shape,
label_width=label_width,
shuffle=True,
seed = seed,
batch_size=batch_size
)
for i in range(3):
batch = dataiter.next()
# here set seed each time executing
seed = random.randint(0, 5000)
print(seed)
mx.random.seed(seed)
batch = dataiter.next()
# on my platform, the printed number stays same each time
print(batch.data[0][20][2][15][50])
```
## Steps to reproduce
(Paste the commands you ran that produced the error.)
1. Just change the parameters in the code to define a dataiter with some .rec file, and save the python script as xxx.py
2. run the python script: python xxx.py several times, and the printed seed changes each time while the printed element in the batch stays same each time.
## What have you tried to solve it?
1. use reset() method after each epoch to change the random seed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services