我一直在尝试运行 2017 年编写的代码,它使用tensorflow=1.3.0
和dm-sonnet=1.14
. 许多所需的包都变得不可用了,我被依赖问题淹没了,所以我决定在新版本的 tensorflow 中重写代码。
我有:
tensorflow=2.3.1
tensorflow-addons=0.11.2
tensorflow-estimator=2.3.0
tensorflow-probability=0.11.1
dm-sonnet=2.0.0
许多更新只是简单的更新tf1
,tf2
但我对版本有无穷无尽的问题dm-sonnet
。
代码有:
class CosineWeights(snt.AbstractModule):
我得到:
AttributeError: module 'sonnet' has no attribute 'AbstractModule'
我怀疑这只是将代码更新sonnet=1.14
为十四行诗的问题,2.0
但我找不到它的“翻译”,或者现在如何使用 AbstractModule。取而代之的是哪个模块,只做 snt.Module 就足够了吗?我将不胜感激任何帮助!