当前位置:网站首页>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()
边栏推荐
- Summary of common commands of vim
- 爬虫相关文章收藏:pyppeteer 、Burpsuite
- 我在中山,到哪里开户比较好?在线开户安全么?
- Speed test of adding, deleting, modifying and querying 5million pieces of data in a single MySQL table
- 安装 新版本cmake & swig & tinyspline
- npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. npm ER
- SQL 函数
- pcl install
- VI summary of common commands
- The shutter tabbar listener is called twice
猜你喜欢

jz2440---使用uboot烧录程序
Optimization of power assisted performance of QPM suspended window

Deep learning (tentsorflow2. version) three good student performance problems (1)

install realsense2: The following packages have unmet dependencies: libgtk-3-dev

2021-11-29 轨迹规划五次多项式

2021 national vocational college skills competition (secondary vocational group) network security competition questions (1) detailed analysis tutorial

GAN Inversion: A Survey
How to correctly open the USB debugging and complete log functions of Huawei mobile phones?

Joint Noise-Tolerant Learning and Meta Camera Shift Adaptation for Unsupervised Person Re-ID

Redis notes (13) - scan and keys search for specific prefix key fields (command format, usage examples, locating large keys)
随机推荐
This new change of go 1.16 needs to be adapted: the changes of go get and go install
install realsense2: The following packages have unmet dependencies: libgtk-3-dev
Jz2440 - - - utiliser le programme de gravure uboot
Leetcode refers to offer II 091 Paint house - modify in place
OpenCV depthframe -> pointcloud 导致 segmentation fault!
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.npm ER
SQL advanced tutorial
A Style-Based Generator Architecture for Generative Adversarial Networks
Test instructions - common interface protocol analysis
Use recursion or a while loop to get the name of the parent / child hierarchy
我在中山,到哪里开户比较好?在线开户安全么?
Specific implementation comparison between different programming languages
[trajectory planning] testing of ruckig Library
Logical English structure [key points]
VI summary of common commands
Throttling, anti chattering, new function, coriolism
Single sign on logic
Joint Noise-Tolerant Learning and Meta Camera Shift Adaptation for Unsupervised Person Re-ID
测试实践——app 测试注意点
做测试需要知道的内容——url、弱网、接口、自动化、