python - NameError:未定义名称“example_batch_predictions”
问题描述
我正在运行代码并收到此错误。代码如下。
for input_example_batch, target_example_batch in dataset.take(1):
example_batch_predictions = model(input_example_batch)
print(example_batch_predictions.shape,"(BATCH_SIZE, sequence_length,vocab_size)")
model.summary()
sampled_indices = tf.random.categorical(example_batch_predictions,num_samples=1)
sampled_indices = tf.squeeze(sampled_indices,axis=-1).numpy()
我收到的错误是
NameError Traceback (最近一次调用最后一次) ipython-input-45-f7c2773af286> in module() sampled_indices = tf.random.categorical(example_batch_predictions, num_samples=1) sampled_indices = tf.squeeze(sampled_indices,axis=-1).numpy( )
NameError:未定义名称“example_batch_predictions”
解决方案
推荐阅读
- spring - Spring AOP:扩展类时的@within 行为
- python - 在anaconda环境中安装本地包
- database - 显式连接与隐式连接?
- wordpress - Wordpress如何添加主题安装
- postgresql - 删除 postgresql 循环中的括号
- visualization - 将 Nef 多面体保存为 Polyhedron_3 或 Surface_mesh 会给出不同的结果
- css - Angular 6 全局 css 的替代方式
- java - Java Hashmap 内部工作原理 123
- google-bigquery - 合并两列并创建新行
- druid - DRUID:获取给定日期范围的天数以获得平均值