(img)
return img
Ensure imgH <= imgW.
Ensure imgH <= imgW.
Ensure imgH < = imgW .
def assureRatio(img):
    """Ensure imgH <= imgW."""
    b, c, h, w = img.size()
    if h > w:
        main = nn.UpsamplingBilinear2d(size=(h, h), scale_factor=None)
        img = main(img)
    return img
def assureRatio ( img ) : b , c , h , w = img . size ( ) if h > w : main = nn . UpsamplingBilinear2d ( size = ( h , h ) , scale_factor = None ) img = main ( img ) return img