Closed WangQingchen123 closed 6 months ago
multi_step_neuron设置成IFNode试试
multi_step_neuron设置成IFNode试试
非常感谢你的帮助!这个问题解决了! 但是还有一个问题让我很困惑 `model = multi_step_spiking_resnet101(pretrained=True).eval() img = read_image('../pictures/cat.jpg')
input_tensor = normalize(resize(img, (224, 224)) / 255., [0.485, 0.456, 0.406], [0.229, 0.224, 0.225]) input_tensor = input_tensor.unsqueeze(0).repeat(4,1,1,1,1) input_tensor.requiresgrad() out = model(input_tensor)`
在调用model计算时,报错cannot register a hook on a tensor that doesn't require gradient
eval模式下有的神经元会屏蔽梯度计算
解决了,非常感谢!
When I use
spikingjelly.clock_driven.model.sew_resnet.multi_step_sew_resnet101
, I got errorTypeError: 'NoneType' object is not callable
And models like spiking_resnet and spiking_vgg have the same problem when called. The exact location of the reported error: `class MultiStepSEWResNet(nn.Module): def init(self, block, layers, num_classes=1000, zero_init_residual=False, groups=1, width_per_group=64, replace_stride_with_dilation=None, norm_layer=None, T:int=None, cnf: str=None, multi_step_neuron: callable = None, **kwargs): super().init() self.T = T if norm_layer is None: norm_layer = nn.BatchNorm2d self._norm_layer = norm_layer在初始化时,
self.sn1 = multi_step_neuron(**kwargs)
在这句报错了。