We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
源代码 conv_weight = self.conv.weight conv_shape = conv_weight.shape conv_weight_hd = torch.cuda.FloatTensor(conv_shape[0], conv_shape[1], 3 * 3).fill_(0) conv_weight_hd[:, :, [0, 3, 6]] = conv_weight[:, :, :]
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
这儿赋值时显示conv_weight是cpu,conv_weight_hd是cuda,即使此处改了device问题但其他地方依然存在该问题,请问应该如何有效处理呢
The text was updated successfully, but these errors were encountered:
def forward(self, x): w1, b1 = self.conv1_1.get_weight() w2, b2 = self.conv1_2.get_weight() w3, b3 = self.conv1_3.get_weight() w4, b4 = self.conv1_4.get_weight() w5, b5 = self.conv1_5.weight, self.conv1_5.bias w = w1 + w2 + w3 + w4 + w5 b = b1 + b2 + b3 + b4 + b5 res = nn.functional.conv2d(input=x, weight=w, bias=b, stride=1, padding=1, groups=1) return res
此处的w1和后面的w也存在该问题
Sorry, something went wrong.
No branches or pull requests
源代码
conv_weight = self.conv.weight
conv_shape = conv_weight.shape
conv_weight_hd = torch.cuda.FloatTensor(conv_shape[0], conv_shape[1], 3 * 3).fill_(0)
conv_weight_hd[:, :, [0, 3, 6]] = conv_weight[:, :, :]
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
这儿赋值时显示conv_weight是cpu,conv_weight_hd是cuda,即使此处改了device问题但其他地方依然存在该问题,请问应该如何有效处理呢
The text was updated successfully, but these errors were encountered: