From the source code 2, I found nearly all of the torchvision.transforms inherit nn.Module.
But in the official tutorial on custom transforms we can create the custom transform from scratch (without the inheritance from nn.Module).
I found in the source code 2, even those transforms are created from scratch  (without the inheritance from nn.Module), it seems that these transforms will still work well.
So why most torchvision.transforms inherit nn.Module? And do we need to inherit nn.Module if we build our own custom transforms?