- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图将 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/
我试图将 CNN 模型拟合到某些输入数据 df,其中 df 是 (921 x10170)。 我的代码: from numpy import * X = df.iloc[:,0:10165] X =
我是一名优秀的程序员,十分优秀!