Could you post the definition of self.block0 and self.block1?
Based on your description, I would assume you’ve defined them as nn.Sequential modules, but then you would get an error calling model.block0.grad.