我目前正在使用this repo执行自然语言处理,并使用我自己的数据集了解更多关于CNN的信息,但我一直遇到关于形状不匹配的错误: ValueError: Target size (torch.Size([64])) must be the same as input size (torch.Size([15]))
11 for epoch in tqdm(range(([15, 64]) <em
在增加CPU和RAM大小的同时,目标尺寸也在增加,
我删除了这段代码,我使用的是“cpu”,而不是“cuda”。python3.7/site-packages/torch/nn/functional.py", line 2433, in binary_cross_entropy_with_logits
raise ValueError("Target size ({}) must be t
)x = x.reshape(-1, 2)Input dimension before calling forward: torch.SizeValueError: Target size (torch.Size([2])) must be the same as input size (torch.Size([504, 2]))
我已经研究过他们提到使用
backpropagation File "c:\Users\#####\BERT.py", line 193, in <module>ValueError: Target size (torch.Size([32])) must be the same as input size (torch.Size([32, 3]))
现在我知道32是批次大小,但不确定这个目标在哪里
: Target size (torch.Size([8, 1])) must be the same as input size (torch.Size([8, 4]))# defineloss_values.append(avg_train_loss)我的批次大小为8,目标有4个类。不带
b_labels = b_labels.unsqueeze(