python - 手动将 tf.contrib.slim 升级到 tf 2.0

标签 python tensorflow upgrade slim

我使用 tf.contrib.slim 的 python 代码有问题功能并且在升级到 tensorflow 到 2.0 后不再起作用。

如何将以下内容升级到 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 )

但是,将包更新到 TF2 的推送请求仍然未决。所以你应该从分支安装pip install git+https://github.com/adrianc-a/tf-slim.git@remove_contrib

关于python - 手动将 tf.contrib.slim 升级到 tf 2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58628439/

相关文章:

python - 为什么 "geometry()"方法会延迟工作?

python - 防止脚本滥用 Web 应用程序的最简单方法?

python - 在 python 中搜索二维数组 - 最佳方法+缩进错误

tensorflow - 可变大小的 tensorflow 常数

python - 制作一个可停止的简单秒表

python - Tensorflow slim 训练和验证初始模型

android - Android 上高效的批量 SQL 查询执行,用于升级数据库

Angular 2 路由返回空白页,没有错误

mysql - 如何将我在 Debian 上安装的 MySQL 升级到新的构建版本?

c++ - 如何从 C++ 使用 Keras SavedModel