Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 无法转换类型为<;的对象;类别';tensorflow.python.distribute.values.PerReplica'&燃气轮机;到张量。佩雷普利卡_Python 3.x_Tensorflow_Multi Gpu - Fatal编程技术网

Python 3.x 无法转换类型为<;的对象;类别';tensorflow.python.distribute.values.PerReplica'&燃气轮机;到张量。佩雷普利卡

Python 3.x 无法转换类型为<;的对象;类别';tensorflow.python.distribute.values.PerReplica'&燃气轮机;到张量。佩雷普利卡,python-3.x,tensorflow,multi-gpu,Python 3.x,Tensorflow,Multi Gpu,我在带有4个GPU的EC2实例上训练了一个TensorFlow代码,得到了这个错误。我的培训和测试策略如下代码所示。有什么想法或建议吗 提前谢谢 mirrored_strategy = tf.distribute.MirroredStrategy() test_ds = test_ds.repeat(repeat_size).shuffle(1000).batch(global_batch_size).prefetch(buffer_size=tf.data.experimental.AUTOT

我在带有4个GPU的EC2实例上训练了一个TensorFlow代码,得到了这个错误。我的培训和测试策略如下代码所示。有什么想法或建议吗

提前谢谢

mirrored_strategy = tf.distribute.MirroredStrategy()
test_ds = test_ds.repeat(repeat_size).shuffle(1000).batch(global_batch_size).prefetch(buffer_size=tf.data.experimental.AUTOTUNE) 
dist_dataset_test = mirrored_strategy.experimental_distribute_dataset(test_ds)
TypeError:无法将类型的对象转换为Tensor。目录:佩雷普利卡:{
0:Tensor(“cond_4/Identity:0”,shape=(None,12,64),dtype=float32,device=/job:localhost/replica:0/task:0/device:GPU:0),
1:Tensor(“cond_5/Identity:0”,shape=(None,12,64),dtype=float32,device=/job:localhost/replica:0/task:0/device:GPU:1),
2:Tensor(“cond_6/Identity:0”,shape=(None,12,64),dtype=float32,device=/job:localhost/replica:0/task:0/device:GPU:2),
3:Tensor(“cond_7/Identity:0”,shape=(None,12,64),dtype=float32,device=/job:localhost/replica:0/task:0/device:GPU:3)
将铸造元素考虑为支持类型。
尝试解决方案。
TypeError: Failed to convert object of type <class 'tensorflow.python.distribute.values.PerReplica'> to Tensor. Contents: PerReplica:{
  0: Tensor("cond_4/Identity:0", shape=(None, 12, 64), dtype=float32, device=/job:localhost/replica:0/task:0/device:GPU:0),
  1: Tensor("cond_5/Identity:0", shape=(None, 12, 64), dtype=float32, device=/job:localhost/replica:0/task:0/device:GPU:1),
  2: Tensor("cond_6/Identity:0", shape=(None, 12, 64), dtype=float32, device=/job:localhost/replica:0/task:0/device:GPU:2),
  3: Tensor("cond_7/Identity:0", shape=(None, 12, 64), dtype=float32, device=/job:localhost/replica:0/task:0/device:GPU:3)
}. Consider casting elements to a supported type.