ValueError:could not broadcast input array from shape (450,600,3) into shape (64,64,3)

在这里插入图片描述
笔者的朋友在使用TensorFlow框架时出现如上问题,其原因为尺寸不匹配,通过resize即可解决

a.resize((64,64,3))

reshape与resize区别:
reshape:有返回值,所谓有返回值,即不对原始多维数组进行修改;
resize:无返回值,所谓有返回值,即会对原始多维数组进行修改;

注意:如果直接在长串代码后使用resize函数无法解决问题,建议分步操作。

发布了25 篇原创文章 · 获赞 28 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/qq_30680871/article/details/90414003