这个问题可能对您有所帮助,它说明了如何实现TPUStrategy
,这是TF <2.0中tf.contrib
的流行功能。
因此,在TF 1.X中,您可以执行以下操作:
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)
在不推荐使用tf.contrib
TF> 2.0中,您可以通过以下方法实现相同的目的:
tf.config.experimental_connect_to_host('grpc://' + os.environ['COLAB_TPU_ADDR'])
resolver = tf.distribute.cluster_resolver.TPUClusterResolver('grpc://' + os.environ['COLAB_TPU_ADDR'])
tf.tpu.experimental.initialize_tpu_system(resolver)
strategy = tf.distribute.experimental.TPUStrategy(resolver)
0
我正在尝试使用Tensorflow Object-Detection-API训练自己的自定义对象检测器
我在Google计算引擎中使用“ pip install tensorflow”安装了tensorflow。然后,我按照该站点上的所有说明进行操作: https : //tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html
当我尝试使用train.py时,出现以下错误消息:
当我尝试学习tensorflow的版本时,我也会得到不同的结果。
当我使用
我该怎么做才能解决这个问题?除了以下内容,我找不到与此错误消息有关的任何东西: tensorflow'module'对象没有属性'contrib'