我正在尝试遵循 Windows 上的 TensorFlow 教程:https : //www.tensorflow.org/tutorials/eager/custom_training_walkthrough
具体来说,我对此部分有疑问:
plt.scatter(features['petal_length'],
features['sepal_length'],
c=labels,
cmap='viridis')
plt.xlabel("Petal length")
plt.ylabel("Sepal length");
Run Code Online (Sandbox Code Playgroud)
关于 c = 标签,返回以下错误:TypeError: object of type 'tensorflow.python.framework.ops.EagerTensor' has no len()
我已经确定我需要转换为一个 numpy 数组,如下所示:
plt.scatter(features['petal_length'],
features['sepal_length'],
c=labels.numpy(),
cmap='viridis')
plt.xlabel("Petal length")
plt.ylabel("Sepal length");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3328 次 |
| 最近记录: |