📌  相关文章
📜  InternalError: Assigned device 'job:worker replica:0 task:0 device:TPU:0' 没有为 _Arg [[{{node iterator_2}}]] [Op:__inference_train_function_15262] 注册 OpKernel 支持 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:08.312000             🧑  作者: Mango

代码示例1
tpu = tf.distribute.cluster_resolver.TPUClusterResolver()  # TPU detection
print('Running on TPU ', tpu.cluster_spec().as_dict()['worker'])

tf.config.experimental_connect_to_cluster(tpu)
tf.tpu.experimental.initialize_tpu_system(tpu)
strategy = tf.distribute.experimental.TPUStrategy(tpu)

print("REPLICAS: ", strategy.num_replicas_in_sync)