问题描述
我的 Python 代码使用了 tf.contrib.slim
功能,并且在升级到 tensorflow 到 2.0 后不再起作用.
I have a problem with my python code that uses tf.contrib.slim
functionalities and no longer works after upgrading to tensorflow to 2.0.
如何将以下内容升级到 tf 2.0:
How can I upgrade the following to tf 2.0:
import tensorflow.contrib.slim as slim
import tensorflow.contrib.slim.nets
# ...
net = slim.conv2d(
inp,
dim,
[3, 3],
rate=1,
normalizer_fn=slim.layer_norm,
activation_fn=lrelu,
scope='g_' + str(width) + '_conv1')
谢谢.
推荐答案
您可以使用 tf_slim
包代替 (https://github.com/google-research/tf-slim)
You can use tf_slim
package instead (https://github.com/google-research/tf-slim)
但是,将包更新到 TF2 的推送请求仍然未决.所以你应该从分支安装pip install git+https://github.com/adrianc-a/tf-slim.git@remove_contrib
However, the push request updating the package to TF2 is still pending. So you should install from the branchpip install git+https://github.com/adrianc-a/tf-slim.git@remove_contrib
这篇关于手动将 tf.contrib.slim 升级到 tf 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!