ptrblck:

should pass targets_layers as a list of strings


Sorry to reply late. Yeah, I passed string actually, like: [‘40’].



 ptrblck:

How large is the difference?


The shape between the m_o.gradients and net.features[40] is different.



 ptrblck:

Could you try to call net(input) and check the GPU utilizations?


Yes, you’re right. I didn’t call net(input) directly. How can I use multiple GPUs  using ModelOutput? Inheriting class nn.Module and define a forward function?