new() received an invalid combination of arguments

面临的问题:

E TypeError: new() received an invalid combination of arguments - got (float, int, int, int), but expected one of:
E * (*, torch.device device)
E * (torch.Storage storage)
E * (Tensor other)
E * (tuple of ints size, *, torch.device device)
E * (object data, *, torch.device device)
collected 0 items / 1 error

解决方案
将/修改为//
例如
self.conv1 = nn.Conv2d(input_channels, output_channels/4, 1, 1, bias = False)
修改为:
self.conv1 = nn.Conv2d(input_channels, output_channels//4, 1, 1, bias = False)

你可能感兴趣的:(new() received an invalid combination of arguments)