我注意到此代码自 6 月 14 日以来无法运行,因为它说:“模型”对象没有属性“目标张量”。
我在https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/guide/distribute_strategy.ipynb#scrollTo=eQ1QESxxEbCh之后更改了另一种使用 TPU 分发策略的方式
但是这样,我需要设置一个validation_fre参数,这会显着减慢整个训练过程。我该如何处理这个问题?
resolver = tf.contrib.cluster_resolver.TPUClusterResolver('grpc://' + os.environ['COLAB_TPU_ADDR'])
tf.contrib.distribute.initialize_tpu_system(resolver)
strategy = tf.contrib.distribute.TPUStrategy(resolver)
with strategy.scope():
model=myKerasmodel()
model.compile()....