gpt4 book ai didi

python - 类型错误 : _reshape_dispatcher() missing 1 required positional argument: 'newshape'

转载 作者:行者123 更新时间:2023-11-30 09:03:18 25 4
gpt4 key购买 nike

我试图将 CNN 模型拟合到某些输入数据 df,其中 df 是 (921 x10170)。

我的代码:

from numpy import *
X = df.iloc[:,0:10165]
X = X.to_numpy()
X = reshape([X.shape[0], X.shape[1], 1])
X_1 = X[:,0:10080,:]
X_2 = X_train[:,10080:10165,:].reshape(921,85)
Y = df.iloc[:,10168:10170]

并产生错误:

<小时/>

TypeError Traceback (most recent call last) in () 17 X = df.iloc[:,0:10165] 18 X = X.to_numpy()
---> 19 X = reshape([X.shape[0], X.shape[1], 1]) 20 X_train_1 = X[:,0:10080,:] 21 X_train_2 = X_train[:,10080:10165,:].reshape(921,85)

<array_function internals> in reshape(*args, **kwargs)

TypeError: _reshape_dispatcher() missing 1 required positional argument: 'newshape'

我尝试了几种方法,但都不起作用。这里有什么问题呢?谢谢

最佳答案

您忘记提及您要在这里 reshape 的内容:

X = reshape([X.shape[0], X.shape[1], 1])

您需要将其更改为:

X = X.reshape((X.shape[0], X.shape[1], 1))

它会解决你的问题

关于python - 类型错误 : _reshape_dispatcher() missing 1 required positional argument: 'newshape' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59260269/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com