pytorch-grad-cam icon indicating copy to clipboard operation
pytorch-grad-cam copied to clipboard

AssertionError of FullGrad for the inception_v3 model

Open wenchieh opened this issue 2 years ago • 0 comments
trafficstars

For the inception_v3 model in torchvision.models, FullGrad attribution arises the AssertionError about "assert(len(self.bias_data) == len(grads_list))"; I find that the len(self.bias_data) is 96 while len(grads_list)is just 94 when steps into the functions.

It is just from the normal-usage of the function,

model = torchvision.models.inception_v3(weights=models.Inception_V3_Weights.IMAGENET1K_V1) fg = FullGrad(model, [], use_cuda=True) # FullGrad will ignore the given target_layers, so here it is an empty list attr = fg(input_tensor=x.to(device), targets=[ClassifierOutputTarget(tar_clsidx)])

Does anyone also encounter such a problem? Or any suggestions? @jacobgil

wenchieh avatar Dec 22 '22 15:12 wenchieh