jianlong-yuan / syncbn-tensorflow

Synchronized Multi-GPU Batch Normalization
67 stars 13 forks source link

Error of 'outputs.device[-1]' #7

Closed wangq95 closed 5 years ago

wangq95 commented 5 years ago

Hi, when I use this code, an error occurred at this position:

74 if int(outputs.device[-1])== 0:
75 update_moving_mean_op = tf.assign(moving_mean, moving_mean decay + mean (1 - decay)) 76 update_moving_var_op = tf.assign(moving_var, moving_var decay + var (1 - decay)) 77 add_model_variable(moving_mean)
78 add_model_variable(moving_var)

the error message is as follows:

File "/home/wangqiang/cycleGan_make3D/syncbn_tf.py", line 74, in sync_batch_norm if int(outputs.device[-1])== 0: IndexError: string index out of range

Then I print out the 'outputs.devide' and it is NULL, so the index -1 out of the range. Can you help me to solve this problem? Best regards!

jianlong-yuan commented 5 years ago

which version of tensorflow?

wangq95 commented 5 years ago

Hi, I use the Tensorflow 1.3.0 - gpu, should it work in a higher version?

jianlong-yuan commented 5 years ago

Yes, i test on tensorflow 1.7

wangq95 commented 5 years ago

Thank you, I will have a try.

wangq95 commented 5 years ago

Hi, I have try to update the version of Tf to 1.7.0 with Cuda9 and cudnn 7.0, it still not work because of the same problem above,do I have to do additional operations?

wangq95 commented 5 years ago

Hi, I think I find the reason of this error, this function must be used in the scripts who run on multi-gpu, thank you for your work, best regards!