首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Tensorflow text_generation

Tensorflow text_generation
EN

Stack Overflow用户
提问于 2019-01-16 03:45:52
回答 1查看 933关注 0票数 2

我在处理密码

generation

当我到达这一行时,会产生以下错误。

代码语言:javascript
复制
 sampled_indices = tf.random.categorical(example_batch_predictions[0], num_samples=1)
 sampled_indices = tf.squeeze(sampled_indices,axis=-1).numpy()

错误

代码语言:javascript
复制
AttributeError
Traceback (most recent call last)

在……里面

代码语言:javascript
复制
----> 1 sampled_indices = tf.random.categorical(example_batch_predictions[0], num_samples=1)
2 sampled_indices = tf.squeeze(sampled_indices,axis=-1).numpy()

AttributeError: module 'tensorflow._api.v1.random' has no attribute 'categorical'

系统信息- TensorFlow版本: 1.12 Ubuntu上的木星NoteBooks

有什么线索可以说明吗?我想知道是否缺少进口品?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-16 03:53:43

假设tf.random.categorical是logits:docs/python/tf/random/multinomial,那么example_batch_predictions可能已经更改为tf.random.multinomial

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54210128

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档