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):
      return inp
    @staticmethod
    def backward(ctx, grad_out):
      foo = Values
      return grad_out*0, None

  return Tagger.apply(inp)