Why get_params() is a staticmethod in transforms?

I was checking the different transforms in vision/transforms.py at main · pytorch/vision · GitHub
in order to see how to implement my custom transform. The get_params() method of different transform classes are marked as staticmethod. What is the reason for this?

The @staticmethod decorator allows you to get the parameters without creating an object, which might be more convenient in some use cases. You could still call the get_params method on the object directly:

transform = transforms.RandomCrop(size=(10, 10))

x = torch.randn(1, 3, 24, 24)
params = transforms.RandomCrop.get_params(x, (10, 10))
params = transform.get_params(x, (10, 10))