tensorflow - TensorFlow 2.2 中如何替换 tf.contrib.seq2seq.TrainingHelper
问题描述
我正在尝试从GitHub运行该项目,但我在使用 TrainingHelper 时遇到了问题。现在,我被它困住了,我不知道如何将它转换为 tf2。控制台总是返回这样的错误:
AttributeError: module 'tensorflow_addons.seq2seq' has no attribute 'TrainingHelper'
请帮我!
解决方案
似乎是https://www.tensorflow.org/addons/api_docs/python/tfa/seq2seq/TrainingSampler
不过,api 有点不同。在 TrainingHelper 的构造函数中传递的一些参数是在 TrainingSampler.initialize() 中传递的。一些返回值也有最小的差异。所以,你必须为代码迁移做一些适配。
推荐阅读
- r - 如何为 R 中带有闪亮的分组复选框输入的每个选择定义填充颜色?
- javascript - 更改主题时更改徽标(和其他 icon.svg)
- php - Laravel 7 在共享主机(hostgator)中部署错误
- jquery - 如何将选择下拉值绑定为反应表的过滤器?
- angular - 角等待 - 脚本重复运行
- css - Vala - Gtk 标签悬停样式 css
- jquery - JQuery Autocomplete 与 IE7 的兼容性
- javascript - Kendo Grid - vendor.js SCRIPT1002:语法错误
- php - PHP:通过 URL 获取外部网站的主机名(确定主机名是否包含“www”)
- sql - 如何每天获取每个班次的数据