If you re using transforms.Resize and pass an int value to the size argument, the smaller edge will be matched to this number.
From the docs 21:

size  ( sequence  or   int ) – Desired output size. If size is a sequence like (h, w), output size will be matched to this. If size is an int, smaller edge of the image will be matched to this number. i.e, if height > width, then image will be rescaled to (size * height / width, size)

If I understand your question correctly, this approach would use both possible resizing strategies depending which edge is smaller.
Let me know, if I misunderstood the question.