Traceback (most recent call last):
File "/home/dell/jing/Coding/ref/pytorch/nnunet/network_architecture/generic_UNetPlusPlus.py", line 534, in
print(modelGUN(img))
File "/home/dell/anaconda3/envs/jing/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/dell/jing/Coding/ref/pytorch/nnunet/network_architecture/generic_UNetPlusPlus.py", line 399, in forward
x0_1 = self.loc4[0](torch.cat([x0_0, self.up40], 1))
RuntimeError: Sizes of tensors must match except in dimension 1. Got 256 and 512 in dimension 2 (The offending index is 1)
Traceback (most recent call last): File "/home/dell/jing/Coding/ref/pytorch/nnunet/network_architecture/generic_UNetPlusPlus.py", line 534, in
print(modelGUN(img))
File "/home/dell/anaconda3/envs/jing/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/dell/jing/Coding/ref/pytorch/nnunet/network_architecture/generic_UNetPlusPlus.py", line 399, in forward
x0_1 = self.loc4[0](torch.cat([x0_0, self.up40], 1))
RuntimeError: Sizes of tensors must match except in dimension 1. Got 256 and 512 in dimension 2 (The offending index is 1)
代码错误行在generic_UNetPlusPlus.py的399行,原因是x0_0和self.up40的形状差一倍, 应该是这一层的卷积输出的矩阵形状有问题,请问需要怎么解决,谢谢啦!
实例化参数为: modelGUN = Generic_UNetPlusPlus(input_channels=1, base_num_features=64, num_classes=2, num_pool=5, num_conv_per_stage=2, feat_map_mul_on_downscale=2, conv_op=nn.Conv3d, norm_op=nn.BatchNorm3d, norm_op_kwargs=None, dropout_op=nn.Dropout3d, dropout_op_kwargs=None, nonlin=nn.LeakyReLU, nonlin_kwargs=None, deep_supervision=True, dropout_in_localization=False, final_nonlin=softmax_helper, weightInitializer=InitWeights_He(1e-2), pool_op_kernel_sizes=None, conv_kernel_sizes=None, upscale_logits=False, convolutional_pooling=False, convolutional_upsampling=False, max_num_features=None, basic_block=ConvDropoutNormNonlin, seg_output_use_bias=False)