----> 1 print(np.reshape(x[0],(64,64,3)))
2 print(y[0])
<__array_function__ internals> in reshape(*args, **kwargs)
~\anaconda3\lib\site-packages\numpy\core\fromnumeric.py in reshape(a, newshape, order)
299 [5, 6]])
300 """
--> 301 return _wrapfunc(a, 'reshape', newshape, order=order)
302
303
~\anaconda3\lib\site-packages\numpy\core\fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
56 bound = getattr(obj, method, None)
57 if bound is None:
---> 58 return _wrapit(obj, method, *args, **kwds)
59
60 try:
~\anaconda3\lib\site-packages\numpy\core\fromnumeric.py in _wrapit(obj, method, *args, **kwds)
45 except AttributeError:
46 wrap = None
---> 47 result = getattr(asarray(obj), method)(*args, **kwds)
48 if wrap:
49 if not isinstance(result, mu.ndarray):
ValueError: cannot reshape array of size 1 into shape (64,64,3)
Tags:
目前,我们不知道
x[0]
的值,也不知道它是如何计算/导出的。从错误消息判断,x[0]
的形状似乎为1,在这种情况下,MRE的形状如下所示:如错误消息所示,
x[0]
的大小与目标形状的大小不匹配。数组的大小是形状项的乘积具体来说,shape
(64, 64, 3)
数组需要64*64*3=12288
值的大小但是,
x[0]
只有一个值,这就是为什么numpy
不知道如何执行转换。您需要确保x[0]
的大小正确。例如:相关问题 更多 >
编程相关推荐