torchvision/transforms/transforms.py
def get_params(degrees, translate, scale_ranges, shears, img_size):
        """Get parameters for affine transformation

        Returns:
            sequence: params to be passed to the affine transformation
        """
        angle = random.uniform(degrees[0], degrees[1])
        if translate is not None:
            max_dx = translate[0] * img_size[0]
            max_dy = translate[1] * img_size[1]
            translations = (np.round(random.uniform(-max_dx, max_dx)),
                            np.round(random.uniform(-max_dy, max_dy)))
        else:
            translations = (0, 0)

        if scale_ranges is not None:
            scale = random.uniform(scale_ranges[0], scale_ranges[1])
        else:
            scale = 1.0

        if shears is not None:
            shear = random.uniform(shears[0], shears[1])
        else:
            shear = 0.0

        return angle, translations, scale, shear
def get_params(degrees, translate, scale_ranges, shears, img_size):
        angle = random.uniform(degrees[0], degrees[1])
        if translate is not None:
            max_dx = translate[0] * img_size[0]
            max_dy = translate[1] * img_size[1]
            translations = (np.round(random.uniform(-max_dx, max_dx)),
                            np.round(random.uniform(-max_dy, max_dy)))
        else:
            translations = (0, 0)

        if scale_ranges is not None:
            scale = random.uniform(scale_ranges[0], scale_ranges[1])
        else:
            scale = 1.0

        if shears is not None:
            shear = random.uniform(shears[0], shears[1])
        else:
            shear = 0.0

        return angle, translations, scale, shear
def get_params ( degrees , translate , scale_ranges , shears , img_size ) : angle = random . uniform ( degrees [ 0 ] , degrees [ 1 ] ) if translate is not None : max_dx = translate [ 0 ] * img_size [ 0 ] max_dy = translate [ 1 ] * img_size [ 1 ] translations = ( np . round ( random . uniform ( - max_dx , max_dx ) ) , np . round ( random . uniform ( - max_dy , max_dy ) ) ) else : translations = ( 0 , 0 ) if scale_ranges is not None : scale = random . uniform ( scale_ranges [ 0 ] , scale_ranges [ 1 ] ) else : scale = 1.0 if shears is not None : shear = random . uniform ( shears [ 0 ] , shears [ 1 ] ) else : shear = 0.0 return angle , translations , scale , shear
Get parameters for affine transformation

        Returns:
            sequence: params to be passed to the affine transformation
Get parameters for affine transformation