当前位置:网站首页>【Tensorflow2】tensorflow1.x-tensorflow2.x一些接口的转变
【Tensorflow2】tensorflow1.x-tensorflow2.x一些接口的转变
2022-08-08 22:58:00 【摇曳的树】
1. AttributeError: ‘BatchDataset’ object has no attribute ‘make_one_shot_iterator’
tensorflow1.X版本写法:
data_it = dataset.make_one_shot_iterator()
tensorflow2.X版本写法:
data_it = tf.compat.v1.data.make_one_shot_iterator(dataset)
2. AttributeError: module ‘tensorflow_core._api.v2.random’ has no attribute ‘set_random_seed’
tensorflow1.X版本写法:
seed=tf.random.set_random_seed(1234)
tensorflow2.X版本写法:
seed=tf.random.set_seed(1234)
3. AttributeError: module ‘tensorflow’ has no attribute ‘decode_raw’
tensorflow1.X版本写法:
gt_binary_image = tf.decode_raw(features['gt_binary_image_raw'], tf.uint8)
tensorflow2.X版本写法:
gt_binary_image = tf.io.decode_raw(features['gt_binary_image_raw'], tf.uint8)
4. AttributeError: module ‘tensorflow’ has no attribute ‘FixedLenFeature’
tensorflow1.X版本写法:
'gt_image_raw': tf.FixedLenFeature([], tf.string)
tensorflow2.X版本写法:
'gt_image_raw': tf.io.FixedLenFeature([], tf.string)
5. AttributeError: module ‘tensorflow’ has no attribute ‘parse_single_example’
tensorflow1.X版本写法:
features = tf.parse_single_example
tensorflow2.X版本写法:
features = tf.io.parse_single_example(dataset)
边栏推荐
- The second side of Tencent technical support internship - Tencent's father's luck is so sudden (offer received)
- 深拷贝与浅拷贝
- 免费ARP
- 虚拟化类型(配图)
- 如何搭建一套自己公司的知识共享平台
- Upload-labs Pass-02(MIME验证)
- Dynamic Host Configuration Protocol DHCP (DHCPv4)
- C# 开发中遇到的一些小技巧
- Virtualization type (with picture)
- 新安装Laravel Framework 6.18.35 php artisan migrate 报错
猜你喜欢
ArcPy elements batch to dwg
JS中的作用域与作用域链
ALIPAY WEB 登陆rsa加密 分析记录
Kubernetes 实现 CI/CD 发布流程
Roson的Qt之旅#108 QML ListView的布局、方向和堆叠顺序
Application Layer Protocol - RADIUS
你需要来自XXX的权限才能对此文件夹进行更改
雷电模拟器frida脱壳
MES docks with Simba to realize IMEI number writing and coupling test of Spreadtrum platform
删除排序数组中的重复项(Leetcode26)
随机推荐
ABP中的数据过滤器
Python object-oriented
股市预测,销量预测,病毒传播...一个时间序列建模套路搞定全部!
新安装Laravel Framework 6.18.35 php artisan migrate 报错
Pyhton面对对象
加载 已训练模型 张量的 几种方法
JSDay1-合并两个有序数组
BSV 上高效的多方公平交易
让IPv6强大的关键——NDP邻居发现协议
MySQL query problem?
浅析WLAN——无线局域网
The second side of Tencent technical support internship - Tencent's father's luck is so sudden (offer received)
JSDay2-两个数组的交集
JSDay2-多个数组的交集
选择排序
买股票要选择哪家证券公司更好?网上客户经理开户安全吗
Go语言并发编程基础上下文概念是什么
虚拟化类型(配图)
SublimeText 3清凉编辑器php开发自定义颜色文字主题配置加汉化
Analysis of WLAN - Wireless Local Area Network