Pre-processing using torchvision.transforms.functional

By “using both of the transforms” do you mean applying the transformation on the image and target?
If so, that would be necessary, since otherwise you would e.g. randomly crop the image and target using other parameters, thus destroying the correspondence between both.

Have a look at this example.