Closed herleeyandi closed 5 years ago
Hi I try to build ESPNet with class=2, p=2, q=8. I got error like this.
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) <ipython-input-35-0e6836058e7e> in <module>() 1 import module_ESPNet as net ----> 2 espnet = ESPNet(2, 2, 8) 3 #espnet.to(GPU_ID) 4 #enet.cpu() <ipython-input-31-ee42dd8d8112> in __init__(self, classes, p, q, encoderFile) 332 333 self.up_l3 = nn.Sequential(nn.ConvTranspose2d(classes, classes, 2, stride=2, padding=0, output_padding=0, bias=False)) --> 334 self.combine_l2_l3 = nn.Sequential(BR(2*classes), DilatedParllelResidualBlockB(2*classes , classes, add=False)) 335 336 self.up_l2 = nn.Sequential(nn.ConvTranspose2d(classes, classes, 2, stride=2, padding=0, output_padding=0, bias=False), BR(classes)) <ipython-input-31-ee42dd8d8112> in __init__(self, nIn, nOut, add) 175 n = int(nOut/5) 176 n1 = nOut - 4*n --> 177 self.c1 = C(nIn, n, 1, 1) 178 self.d1 = CDilated(n, n1, 3, 1, 1) # dilation rate of 2^0 179 self.d2 = CDilated(n, n, 3, 1, 2) # dilation rate of 2^1 <ipython-input-31-ee42dd8d8112> in __init__(self, nIn, nOut, kSize, stride) 92 super().__init__() 93 padding = int((kSize - 1)/2) ---> 94 self.conv = nn.Conv2d(nIn, nOut, (kSize, kSize), stride=stride, padding=(padding, padding), bias=False) 95 96 def forward(self, input): ~/.conda/envs/deep/lib/python3.6/site-packages/torch/nn/modules/conv.py in __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, groups, bias) 313 super(Conv2d, self).__init__( 314 in_channels, out_channels, kernel_size, stride, padding, dilation, --> 315 False, _pair(0), groups, bias) 316 317 @weak_script_method ~/.conda/envs/deep/lib/python3.6/site-packages/torch/nn/modules/conv.py in __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, transposed, output_padding, groups, bias) 41 else: 42 self.register_parameter('bias', None) ---> 43 self.reset_parameters() 44 45 def reset_parameters(self): ~/.conda/envs/deep/lib/python3.6/site-packages/torch/nn/modules/conv.py in reset_parameters(self) 45 def reset_parameters(self): 46 n = self.in_channels ---> 47 init.kaiming_uniform_(self.weight, a=math.sqrt(5)) 48 if self.bias is not None: 49 fan_in, _ = init._calculate_fan_in_and_fan_out(self.weight) ~/.conda/envs/deep/lib/python3.6/site-packages/torch/nn/init.py in kaiming_uniform_(tensor, a, mode, nonlinearity) 286 >>> nn.init.kaiming_uniform_(w, mode='fan_in', nonlinearity='relu') 287 """ --> 288 fan = _calculate_correct_fan(tensor, mode) 289 gain = calculate_gain(nonlinearity, a) 290 std = gain / math.sqrt(fan) ~/.conda/envs/deep/lib/python3.6/site-packages/torch/nn/init.py in _calculate_correct_fan(tensor, mode) 255 raise ValueError("Mode {} not supported, please use one of {}".format(mode, valid_modes)) 256 --> 257 fan_in, fan_out = _calculate_fan_in_and_fan_out(tensor) 258 return fan_in if mode == 'fan_in' else fan_out 259 ~/.conda/envs/deep/lib/python3.6/site-packages/torch/nn/init.py in _calculate_fan_in_and_fan_out(tensor) 189 receptive_field_size = 1 190 if tensor.dim() > 2: --> 191 receptive_field_size = tensor[0][0].numel() 192 fan_in = num_input_fmaps * receptive_field_size 193 fan_out = num_output_fmaps * receptive_field_size IndexError: index 0 is out of bounds for dimension 0 with size 0
See #13
hi! Have you solved this problem? I just meet the same error like you, would you like to tell me what did you do please?
Hi I try to build ESPNet with class=2, p=2, q=8. I got error like this.