I personally am a big fan of loud and proper error messages, which would also be raised in case you are using the torchvision.transforms.Normalize transformation, since it’s using an inplace op as seen here.
I’m unsure why the detection.transform implementation doesn’t use torchvision.transforms.functional.normalize to get the same behavior and avoid code duplication, but it might have been used exactly to add this type of “flexibility” so that users are able to pass grayscale images.
CC @fmassa is my speculation correct or should these transformations be rather “unified”?