You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem initializing DT_DOUBLE variables in distributed TF #4767
If you save code below as init_bug.py and run as python init_bug.py, it crashes with error below when running init_op. It works fine using local session or when changing dtype to np.float32. Also fails for np.int32 type. Tried on 0.11rc0 on MacOS
tensorflow.python.framework.errors.InternalError: Output 0 of type float_ref does not match declared output type double_ref for node Variable = Variable[container="", dtype=DT_DOUBLE, shape=[], shared_name="", _device="/job:worker/replica:0/task:0/cpu:0"]()
I ran your program (with an additional print sess.run(global_param_var) to confirm it was working) using 0.11rc0 on Linux, and I couldn't reproduce your problem.
I presume you're falling foul of implicit by-name variable sharing between sessions on the same server. If you create a DT_FLOAT variable called "Variable" on the server, then create a DT_DOUBLE variable called "Variable" in a different session on the same server, you'll get the error you described.
To avoid the problem, call tf.Session.reset("grpc://" + worker_ip) before starting a subsequent session, or use a with tf.container(): block to place the variables in different namespaces.
PS: it seems more robust to just kill processes, tf.Session.reset seems to occasionally hang if called at the same time as launching the server process
Activity
yaroslavvb commentedon Oct 4, 2016
same problem if I use
ones_initializerorzeros_initializerwith anydtypeother thanfloat32@mrrymrry commentedon Oct 4, 2016
I ran your program (with an additional
print sess.run(global_param_var)to confirm it was working) using 0.11rc0 on Linux, and I couldn't reproduce your problem.I presume you're falling foul of implicit by-name variable sharing between sessions on the same server. If you create a
DT_FLOATvariable called"Variable"on the server, then create aDT_DOUBLEvariable called"Variable"in a different session on the same server, you'll get the error you described.To avoid the problem, call
tf.Session.reset("grpc://" + worker_ip)before starting a subsequent session, or use awith tf.container():block to place the variables in different namespaces.yaroslavvb commentedon Oct 4, 2016
Ah, indeed, it was remembering old state, tf.Session.reset fixes things, thanks!
yaroslavvb commentedon Oct 4, 2016
PS: it seems more robust to just kill processes,
tf.Session.resetseems to occasionally hang if called at the same time as launching the server process