Solved by albanD in post #6 
              
              
                In that case, if it doesn’t require gradients, I would just capture it to avoid this issue altogether: it is just a constant Tensor that the autograd doesn’t need to know about. 
def tagger(inp, Values):
  class Tagger(torch.autograd.Function):
    @staticmethod
    def forward(ctx, inp):
      retu…