zhc940702 / CGATCPred

5 stars 2 forks source link

Size mismatch error #2

Open aparnaburhade opened 6 months ago

aparnaburhade commented 6 months ago

Hi! I'm actually trying to run this code but unfortunately I'm stuck at this one error from days and I'm not understanding what to do about it.

Traceback (most recent call last): File "cross_validation.py", line 301, in main() File "cross_validation.py", line 297, in main train_test_five_fold(args) File "cross_validation.py", line 272, in train_test_five_fold ten_fold_files(Drug_feature, ATC_feature, Drug_ATC_label, args) File "cross_validation.py", line 112, in ten_fold_files total_Aiming, total_Coverage, total_Abs_True_Rate, total_Abs_False_Rate, total_Accuracy, total_Hamming_loss = train_test(X_index[train], y[train], X_index[test], y[test], train_drug_label, Drug_feature, ATC_feature, args) File "cross_validation.py", line 163, in train_test outputs = model(batch_x, torch.from_numpy(ATC_feature).to(device)) File "C:\Users\aparn\anaconda3\envs\py36env\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, *kwargs) File "C:\Users\aparn\Downloads\4552917\network_kfold.py", line 132, in forward x = F.relu(self.linear(x)) File "C:\Users\aparn\anaconda3\envs\py36env\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(input, **kwargs) File "C:\Users\aparn\anaconda3\envs\py36env\lib\site-packages\torch\nn\modules\linear.py", line 91, in forward return F.linear(input, self.weight, self.bias) File "C:\Users\aparn\anaconda3\envs\py36env\lib\site-packages\torch\nn\functional.py", line 1674, in linear ret = torch.addmm(bias, input, weight.t()) RuntimeError: size mismatch, m1: [32 x 215040], m2: [3584 x 1010] at ..\aten\src\TH/generic/THTensorMath.cpp:41

can you help me with this please?

shashank-dubey-developer commented 6 months ago

Hi Aparnaaa, where did you find this file cross_validation.py?