AttributeError: module 'tensorflow' has no attribute 'contrib' 报错代码 原因分析 解决办法 安装 用法 报错代码 conv = tf.contrib.layers.batch_norm() 原因分析 因为使用了TF1.x的库,而环境是TF2.x的版本,此时tf.contrib模块已被移除,根据官方迁移指南对其修改。 查看TF Slim源码发现名字接近的函数 def batch_norm() 解决办法