擅长:python、mysql、java
<p>我在使用<code>dataset= strategy.experimental_distribute_dataset(train_dataset)</code>和<code>model.fit(dataset)</code>时也遇到了类似的错误。在</p>
<p>删除<code>strategy.experimental_distribute_dataset</code>之后。它工作得很好。这与<a href="https://www.tensorflow.org/guide/distributed_training" rel="nofollow noreferrer">TF document</a>相似,他们说<code>keras.Model.fit()</code>自动处理所有事情,只有当我们想用<code>tf.GradientTape()</code>进行定制训练时,我们才需要手动的分布式数据集。在</p>
<p>你可以通过<a href="https://www.tensorflow.org/tutorials/distribute/custom_training" rel="nofollow noreferrer">offical tutorial of MNIST</a>了解更多信息</p>