def _get_params(self, shape):
    ndim = len(shape)
    params = self._get_param_values()
    p = params['p']
    param_angle = params['angle']
    param_translate = params['translate']
    param_scale = params['scale']
    param_shear = params['shear']
    if isinstance(param_angle, Number):
        param_angle = ((- param_angle), param_angle)
    if isinstance(param_translate, Number):
        param_translate = (((- param_translate), param_translate),)
    if isinstance(param_scale, Number):
        param_scale = tuple(sorted([(1.0 - param_scale), (1.0 + param_scale)]))
    if isinstance(param_shear, Number):
        param_shear = (((- param_shear), param_shear),)
    param_translate = self._format_param(param_translate, ParamKind.MULTI_ARG, ndim)
    param_shear = self._format_param(param_shear, ParamKind.MULTI_ARG, ndim)
    (angle, translate, scale, shear) = (None, None, None, None)
    if ((param_angle is not None) and (self._rand() < p['angle'])):
        angle = self._rand_range(*param_angle)
    if ((param_translate is not None) and (self._rand() < p['translate'])):
        translate = [int((self._rand_range(*x) * s)) for (x, s) in zip(param_translate, shape)]
    if ((param_scale is not None) and (self._rand() < p['scale'])):
        scale = self._rand_range(*param_scale)
    if ((param_shear is not None) and (self._rand() < p['shear'])):
        shear = [self._rand_range(*x) for x in param_shear]
    return (angle, translate, scale, shear)
def _get_params(self, shape):
    ndim = len(shape)
    params = self._get_param_values()
    p = params['p']
    param_angle = params['angle']
    param_translate = params['translate']
    param_scale = params['scale']
    param_shear = params['shear']
    if isinstance(param_angle, Number):
        param_angle = ((- param_angle), param_angle)
    if isinstance(param_translate, Number):
        param_translate = (((- param_translate), param_translate),)
    if isinstance(param_scale, Number):
        param_scale = tuple(sorted([(1.0 - param_scale), (1.0 + param_scale)]))
    if isinstance(param_shear, Number):
        param_shear = (((- param_shear), param_shear),)
    param_translate = self._format_param(param_translate, ParamKind.MULTI_ARG, ndim)
    param_shear = self._format_param(param_shear, ParamKind.MULTI_ARG, ndim)
    (angle, translate, scale, shear) = (None, None, None, None)
    if ((param_angle is not None) and (self._rand() < p['angle'])):
        angle = self._rand_range(*param_angle)
    if ((param_translate is not None) and (self._rand() < p['translate'])):
        translate = [int((self._rand_range(*x) * s)) for (x, s) in zip(param_translate, shape)]
    if ((param_scale is not None) and (self._rand() < p['scale'])):
        scale = self._rand_range(*param_scale)
    if ((param_shear is not None) and (self._rand() < p['shear'])):
        shear = [self._rand_range(*x) for x in param_shear]
    return (angle, translate, scale, shear)