Python TensorFlow类型错误:';BatchDataset';对象是不可编辑的
我在跟踪调查。它特别指出,要在虹膜(花)分类的样本项目上实现热切的执行 导入所需的Python模块,包括TensorFlow,并为此程序启用即时执行。急切执行使TensorFlow立即计算操作,返回具体值,而不是创建稍后执行的计算图。如果您习惯于REPL或python交互控制台,您会感到宾至如归 因此,我按照说明进行操作,以实现快速执行,并继续执行说明。然而,当我到达讨论如何将数据集准备成张量流数据集的部分时,我遇到了一个错误 细胞代码 错误Python TensorFlow类型错误:';BatchDataset';对象是不可编辑的,python,python-3.x,tensorflow,google-colaboratory,Python,Python 3.x,Tensorflow,Google Colaboratory,我在跟踪调查。它特别指出,要在虹膜(花)分类的样本项目上实现热切的执行 导入所需的Python模块,包括TensorFlow,并为此程序启用即时执行。急切执行使TensorFlow立即计算操作,返回具体值,而不是创建稍后执行的计算图。如果您习惯于REPL或python交互控制台,您会感到宾至如归 因此,我按照说明进行操作,以实现快速执行,并继续执行说明。然而,当我到达讨论如何将数据集准备成张量流数据集的部分时,我遇到了一个错误 细胞代码 错误 --------------------------
---------------------------------------------------------------------------
TypeError回溯(最近一次调用上次)
在()
7.
8#查看批次中的单个示例条目
---->9个特征,标签=iter(列车数据集)。下一个()
10打印(“示例功能:”,功能[0])
11打印(“示例标签:”,标签[0])
TypeError:“BatchDataset”对象不可编辑
我只想继续下面的例子。如何将
BatchDataset
对象转换为可移植的对象?事实证明,我在项目中没有执行导致此问题的某些步骤
将TensorFlow从1.7升级到1.8:
!pip安装--升级tensorflow
检查TensorFlow是否已更新
此代码单元:
from __future__ import absolute_import, division, print_function
import os
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.contrib.eager as tfe
tf.enable_eager_execution()
print("TensorFlow version: {}".format(tf.VERSION))
print("Eager execution: {}".format(tf.executing_eagerly()))
应返回以下输出:
TensorFlow version: 1.8.0
Eager execution: True
from __future__ import absolute_import, division, print_function
import os
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.contrib.eager as tfe
tf.enable_eager_execution()
print("TensorFlow version: {}".format(tf.VERSION))
print("Eager execution: {}".format(tf.executing_eagerly()))
TensorFlow version: 1.8.0
Eager execution: True