parameters: (method)
return_statement: return new_method
docstring: Wrapper method to check the parameters of random erasing.
docstring_summary: Wrapper method to check the parameters of random erasing.
docstring_tokens: Wrapper method to check the parameters of random erasing .
function: def check_random_erasing(method):
      """Wrapper method to check the parameters of random erasing."""
  
      @wraps(method)
      def new_method(self, *args, **kwargs):
          [prob, scale, ratio, value, inplace, max_attempts], _ = parse_user_args(method, *args, **kwargs)
  
          type_check(prob, (float, int,), "prob")
          type_check_list(scale, (float, int,), "scale")
          if len(scale) != 2:
              raise TypeError("scale should be a list or tuple of length 2.")
          type_check_list(ratio, (float, int,), "ratio")
          if len(ratio) != 2:
              raise TypeError("ratio should be a list or tuple of length 2.")
          type_check(value, (int, list, tuple, str), "value")
          type_check(inplace, (bool,), "inplace")
          type_check(max_attempts, (int,), "max_attempts")
          check_erasing_value(value)
  
          check_value(prob, [0., 1.], "prob")
          if scale[0] > scale[1]:
              raise ValueError("scale should be in (min,max) format. Got (max,min).")
          check_range(scale, [0, FLOAT_MAX_INTEGER])
          check_positive(scale[1], "scale[1]")
          if ratio[0] > ratio[1]:
              raise ValueError("ratio should be in (min,max) format. Got (max,min).")
          check_value_ratio(ratio[0], [0, FLOAT_MAX_INTEGER])
          check_value_ratio(ratio[1], [0, FLOAT_MAX_INTEGER])
          if isinstance(value, int):
              check_value(value, (0, 255))
          if isinstance(value, (list, tuple)):
              for item in value:
                  type_check(item, (int,), "value")
                  check_value(item, [0, 255], "value")
          check_value(max_attempts, (1, FLOAT_MAX_INTEGER))
  
          return method(self, *args, **kwargs)
  
      return new_method
function_tokens: def check_random_erasing ( method ) : @ wraps ( method ) def new_method ( self , * args , * * kwargs ) : [ prob , scale , ratio , value , inplace , max_attempts ] , _ = parse_user_args ( method , * args , * * kwargs ) type_check ( prob , ( float , int , ) , "prob" ) type_check_list ( scale , ( float , int , ) , "scale" ) if len ( scale ) != 2 : raise TypeError ( "scale should be a list or tuple of length 2." ) type_check_list ( ratio , ( float , int , ) , "ratio" ) if len ( ratio ) != 2 : raise TypeError ( "ratio should be a list or tuple of length 2." ) type_check ( value , ( int , list , tuple , str ) , "value" ) type_check ( inplace , ( bool , ) , "inplace" ) type_check ( max_attempts , ( int , ) , "max_attempts" ) check_erasing_value ( value ) check_value ( prob , [ 0. , 1. ] , "prob" ) if scale [ 0 ] > scale [ 1 ] : raise ValueError ( "scale should be in (min,max) format. Got (max,min)." ) check_range ( scale , [ 0 , FLOAT_MAX_INTEGER ] ) check_positive ( scale [ 1 ] , "scale[1]" ) if ratio [ 0 ] > ratio [ 1 ] : raise ValueError ( "ratio should be in (min,max) format. Got (max,min)." ) check_value_ratio ( ratio [ 0 ] , [ 0 , FLOAT_MAX_INTEGER ] ) check_value_ratio ( ratio [ 1 ] , [ 0 , FLOAT_MAX_INTEGER ] ) if isinstance ( value , int ) : check_value ( value , ( 0 , 255 ) ) if isinstance ( value , ( list , tuple ) ) : for item in value : type_check ( item , ( int , ) , "value" ) check_value ( item , [ 0 , 255 ] , "value" ) check_value ( max_attempts , ( 1 , FLOAT_MAX_INTEGER ) ) return method ( self , * args , * * kwargs ) return new_method