当前位置:   article > 正文

tensorflow2到tensorflow1(不重新安装)_如何将tensorflow2换成1

如何将tensorflow2换成1

首先
import tensorflow as tf
改为
import tensorflow.compat.v1 as tf
tf.disable_eager_execution()

还有一些其他的

kernel_initializer = tf.contrib.layers.variance_scaling_initializer()
改为
kernel_initializer = tf.glorot_uniform_initializer()

import tensorflow.contrib.slim as slim
改为
import tf_slim as slim

from tensorflow.contrib.layers.python.layers import initializers
改为
from tf_slim.layers import initializers

from tensorflow.contrib.crf import crf_log_likelihood
from tensorflow.contrib.crf import viterbi_decode
改为
from tensorflow_addons.text.crf import viterbi_decode
from tensorflow_addons.text.crf import crf_log_likelihood

from tensorflow.contrib.compiler import jit
改为
from tensorflow.compiler import jit

参考:
https://zhuanlan.zhihu.com/p/413019685

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/938943
推荐阅读
相关标签
  

闽ICP备14008679号