当前位置:网站首页>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()
边栏推荐
- [pulsar learning] pulsar Architecture Principle
- Explained: A Style-Based Generator Architecture for GANs (StyleGAN)
- Do you know the //go: instructions in the go source code, go:linkname?
- pcl install
- 深度学习(初识tensorflow2.版本)之三好学生成绩问题(1)
- LeetCode 接雨水系列 42.(一维) 407.(二维)
- PHP does not allow images to be uploaded together with data (no longer uploading images before uploading data)
- c语言语法基础之——函数 小程序 求阶乘
- Logview Pro can be used if the log is too large
- 软件测试---如何选择合适的正交表
猜你喜欢

2021-11-29 quintic polynomial of trajectory planning

What you need to know to test -- URL, weak network, interface, automation

Redis novice introduction

Jz2440--- using uboot burning program
![Logical English structure [key points]](/img/4b/52a666ed01087adbc5fa4f9e1db393.png)
Logical English structure [key points]

力扣------从数组中移除最大值和最小值
Optimization of power assisted performance of QPM suspended window

3 big questions! Redis cache exceptions and handling scheme summary

GAN Inversion: A Survey

Thinkphp5 manual error reporting
随机推荐
测试实践——app 测试注意点
QPM performance monitoring components - General
Jupyter Notebook遇到的问题
My creation anniversary
Record a time when the server was taken to mine
PHP does not allow images to be uploaded together with data (no longer uploading images before uploading data)
我在中山,到哪里开户比较好?在线开户安全么?
【CVPR 2019】Semantic Image Synthesis with Spatially-Adaptive Normalization(SPADE)
pcl install
PHP extracts TXT text to store the domain name in JSON data
c语言语法基础之——函数定义学习
Flink入门——单词统计
Several connection query methods of SQL (internal connection, external connection, full connection and joint query)
Go learning notes (83) - code specification and common development skills
Logview Pro can be used if the log is too large
Test instructions - common interface protocol analysis
【AAAI 2021】Few-Shot One-Class Classification via Meta-Learning 【FSOCC via Meta-learning】
install opencv-contrib-dev to use aruco code
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. npm ER
c语言语法基础之——指针(字符、一维数组) 学习