torchvisions transforms has a function called torchvision.transforms.Grayscale(num_output_channels=1). See here 158.
Using num_output_channels=1 this can be used to convert an 3 channel RGB image into a 1 channel grayscale image.
But if used with num_output_channels=3 this creates a 3 channel image with R=G=B.
You can use this function on your 1 channel image to make a 3 channel image where R=G=B, if this is what you want.