解决 AttributeError: 'int' object has no attribute 'reshape'

解决 AttributeError: ‘int’ object has no attribute ‘reshape’

迭代训练时报错
AttributeError Traceback (most recent call last)
in ()
6 for xs, ys in zip(x_data, y_data):
7 xs = xs.reshape(1,18) # 把一维数组[x1,…x18]转化为[[x1,…x18]]
----> 8 ys = ys.reshape(1,1) # Feed数据必须和Placeholder的shape一致
9 _, summary_str, loss = sess.run([optimizer, sum_loss_op, loss_function], feed_dict={x: xs, y: ys})
10 writer.add_summary(summary_str, epoch)
AttributeError: ‘int’ object has no attribute ‘reshape’

往前看时发现np.array未成功,因为还有str,如下图
解决 AttributeError: 'int' object has no attribute 'reshape'_第1张图片
将含有str列删除
解决 AttributeError: 'int' object has no attribute 'reshape'_第2张图片
然后训练模型时正常 (* ̄︶ ̄)

你可能感兴趣的:(深度学习)