I have a short question regarding model constants and persistent state. Let’s say I have something like
class MyModule(nn.Module):
    def __init__(self, n=2):
        self.n = n

What’s the best way to make n part of the persistent state (i.e. the state_dict)? Should I make it a buffer? But then I would need to convert it into a tensor, which seems a bit of a hassle. Is there another more elegant way?