![](/img/trans.png)
[英]'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'squeeze'
[英]type 'tensorflow.python.framework.ops.EagerTensor' has no len()
我正在尝试遵循 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");
关于 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");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.