【发布时间】:2021-02-04 03:03:57
【问题描述】:
假设我有一个带有size=(8,64,1,60,60) 的列表,并且想将其分解为(4,2,64,1,60,60),然后将它们沿轴 1 相加。我尝试了下面的代码,但它出现了错误:
'list' object has no attribute 'reshape'.
请注意,我希望将预测保留为列表,并且不想将其更改为数组。
predictions=list(np.random.randint(5,size=(8,64,1,60,60)))
predictions_sum = predictions.reshape(4,2, *predictions.shape[1:]).sum(axis=1)
【问题讨论】:
标签: python arrays list reshape