问题
I’m trying to train a model and am using tf.contrib.data.batch_and_drop_remainder to prepare my dataset. When I run estimator.train I get the following error:
NotFoundError: Op type not registered 'BatchDatasetV2' in binary running on n-be8b2535-w-0. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.)
tf.contrib.resampler
should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.
I’m not trying to run from a saved graph and I’ve made sure that I’m using a fresh model_dir. How do I fix this? This only happens when I run on TPU. Running on CPU works fine.
回答1:
This error can arise if you have different versions of tensorflow on your VM and on the TPU. Check the version on your VM by running:
import tensorflow
print tensorflow.__version__
Check the version on your TPU by going to the TPU page on the GCP console: https://console.cloud.google.com/compute/tpus
Set the version of tensorflow on your VM via pip. So if you want to set your VM tensorflow version to 1.9, run:
pip install tensorflow==1.9
来源:https://stackoverflow.com/questions/51903149/op-type-not-registered-batchdatasetv2