requires_grad=False by default, and not saved to checkpoint:
self.filter = torch.tensor(...)

requires_grad=True by default, and saved to checkpoint, and shows up in module.parameters():
self.filter = nn.Parameter(torch.tensor(...))

requires_grad=False by default, and saved to checkpoint:
self.filter = self.register_buffer("filter", torch.tensor(...))


If you’re dealing with a constant tensor, you don’t want it showing up in model.parameters() since that makes the following include the constant tensor in the optimizer:
optimizer = torch.optim.SGD(model.parameters(), lr=1e-4)

…this is perhaps not so problematic if you manually also set requires_grad=False, since parameters that have had requires_grad=False set since the beginning of time will be skipped. But it’s nicer to keep buffers separated from parameters.