解决‘tf.ResizeNearestNeighbor‘ op is neither a custom op nor a flex op

解决'tf.ResizeNearestNeighbor' op is neither a custom op nor a flex op

将tensorflow模型转换为TFlite模型:参考我的博客https://panjinquan.blog.csdn.net/article/details/107231435 ,其中可能会出现转换错误:

'tf.ResizeNearestNeighbor' op is neither a custom op nor a flex op
:0: error: failed while converting: 'main': Ops that can be supported by the flex runtime (enabled via setting the -emit-select-tf-ops flag): ResizeNearestNeighbor.

 自从Tensorflow更新到2.0后,我就发现几乎每个版本的都有细微的差异问题,出现这个错误,可能是由于的网络层添加UpSampling2D这些上采样层,但TFlite是支持UpSampling2D操作的.

我可以很负责任的告诉你,TFlite是支持UpSampling2D,在TF2.0下支持float16量化,但不支持int8量化.不能转的原因可能是训练模型的版本,跟你测试的版本不一致导致的,比如当你用TF2.0进行模型训练时,在TF2.2进行TFlite转换,就可能出现这个错误,你需要保证训练和转换TFLite的版本一致即可

你可能感兴趣的:(TensoFlow,tensorflow,NearestNeighbor)