当前位置:网站首页>From TF 1 X to TF 2.6 (update if you encounter it)
From TF 1 X to TF 2.6 (update if you encounter it)
2022-06-26 09:51:00 【A cloud in the sky】
I use it tensorflow 2.6
Generally speaking, in tf 2.x You can use tf.compat.v1.xxxxxx To replace the original tf 1.x Medium tf.xxxxxx
If you make a mistake , Say the function doesn't , In fact, you can go directly to github Of tensorflow Search for this function in the project , see tensorflow How is it used in
Here is a list of the problems encountered
tf 1.x:tf.contrib.layers.xavier_initializer
tf 2.6:tf.keras.initializers.glorot_normal
tf 1.x:tf.contrib.layers
tf 2.6:tf.keras.layers
tf 1.x:from tensorflow.contrib import tpu
tf 2.6:from tensorflow import tpu
tf 1.x:from tensorflow.contrib import data
tf 2.6:from tensorflow import data
tf 1.x:from tensorflow.contrib import metrics
tf 2.6:from tensorflow import metrics
tf 1.x: from tensorflow.contrib import cluster_resolver
tf 2.6: from tensorflow.python.distribute import cluster_resolver
tf 1.x: tf.contrib.layers.layer_norm
tf 2.6: tf.keras.layers.LayerNormalization
The two functions are implemented differently , You can't just change your name
Keras 2.2.5:from keras.optimizers import Adam
Keras 2.6.0:from keras.optimizer_v2.adam import Adam
Keras 2.2.5:from keras.utils import to_categorical
Keras 2.6.0:from keras.utils.np_utils import to_categorical
RuntimeError: When eager execution is enabled, var_list must specify a list or dict of variables to save
When eager execution When it's on ,loss It should be a Python function .
stay Tensorflow 2.0 in ,eager execution Is turned on by default .
therefore , Need to close first eager execution
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
边栏推荐
- MySQL单表500万条数据增、删、改、查速度测试
- OpenCV depthframe -> pointcloud 导致 segmentation fault!
- GAN Inversion: A Survey
- Jupyter Notebook遇到的问题
- Thinkphp5 manual error reporting
- SQL query duplicate record
- I am in Zhongshan. Where can I open an account? Is online account opening safe?
- Flink入门——单词统计
- 2021-11-29 轨迹规划五次多项式
- MapReduce & yarn theory
猜你喜欢

Install new version cmake & swig & tinyspline

Flutter's brain map notes are easy to find and search!

How to create an IE tab in edge browser

Curriculum learning (CL)

WIN10系统实现Redis主从复制

The 100000 line transaction lock has opened your eyes.

Detailed explanation of the network security competition questions (2) of the 2021 national vocational college skills competition (secondary vocational group)

MapReduce&Yarn理论
QPM performance monitoring components - General

Go learning notes (83) - code specification and common development skills
随机推荐
Daily-used English phrases
3 big questions! Redis cache exceptions and handling scheme summary
Badge series 4: use of circle Ci
My creation anniversary
Curriculum learning (CL)
Specific implementation comparison between different programming languages
Meaning of go runtime
mysql 数据库字段查询区分大小写设置
Specific meaning of go bootstrap
点击遮罩层关闭弹窗
[Journal of Computer Aided Design & computer graphics] overview of research on pedestrian re recognition methods based on generated countermeasure network
我的创作纪念日
Does the go compiled executable have dynamic library links?
Redis 新手入门
Badge series 5: use of codecov
How about the security of flush stock trading software? How to open an account in flush
Jz2440 - - - utiliser le programme de gravure uboot
Single sign on logic
Differences between VI and vim and common commands
install opencv-contrib-dev to use aruco code