tensorflow版本升级

更新tensorflow版本

pip install --upgrade --ignore-installed tensorflow==x.x.x

旧版本0.x自动更新升级到2.0
https://blog.csdn.net/u012223913/article/details/79097297

tf_upgrade_v2 --infile ***.py --outfile ***_update.py #高版本自带
python tf_upgrade.py --intree InputDir --outtree OutputDir
tf_upgrade.py --intree InputDir --outtree OutputDir --copyotherfiles True
if __name__ == '__main__':
    fileHandler = open('../report.html', mode='r', encoding='UTF-8')

    report_lines = fileHandler.readlines()
    for line in report_lines:
        print(line.rstrip())

http://dljz.nicethemes.cn/news/show-241321.html

# import tensorflow.contrib.slim as slim
import tf_slim as slim
from  tf_slim  import losses
from tf_slim.nets import resnet_utils
from tf_slim.nets  import resnet_v1
from tf_slim.nets.resnet_v1 import resnet_v1_block

问题:

tensorflow.python.framework.errors_impl.AlreadyExistsError: Another metric with the same name already exists.
#解决:安装指定版本的keras包,我安装的版本是2.6.0
#module 'tensorflow.python.pywrap_tensorflow' has no attribute 'NewCheckpointReader'
#解决:Use tf.compat.v1.train.NewCheckpointReader and it works.

AttributeError: module 'tensorflow' has no attribute  'ConfigProto'
config = tf.compat.v1.ConfigProto()


#AttributeError: module 'tensorflow' has no attribute 'reset_default_graph'
# tf.reset_default_graph()
tf.compat.v1.disable_v2_behavior()
#报错ValueError: Variable resnet_v1_101/conv1/weights already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope?

#AttributeError: module 'tensorflow' has no attribute 'Session'
tf.compat.v1.Session()


#AttributeError: module 'tensorflow._api.v2.train' has no attribute 'import_meta_graph'
#raise RuntimeError(“tf.placeholder() is not compatible with “ RuntimeError: tf.placeholder() is not
tf.compat.v1.disable_eager_execution()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值