parameters: (x, min_val, max_val, min_up, max_up,
                             ema, ema_decay, kernel_name="minmax_update_perlayer")
docstring: MinMaxUpdatePerLayer op
docstring_summary: MinMaxUpdatePerLayer op
docstring_tokens: MinMaxUpdatePerLayer op
function: def minmax_update_perlayer(x, min_val, max_val, min_up, max_up,
                             ema, ema_decay, kernel_name="minmax_update_perlayer"):
      """MinMaxUpdatePerLayer op"""
      input_shape = x.get("shape")
      input_dtype = x.get("dtype")
      min_shape = min_val.get("ori_shape")
      min_dtype = min_val.get("dtype")
      max_shape = max_val.get("ori_shape")
      max_dtype = max_val.get("dtype")
  
      min_shape = util.scalar2tensor_one(min_shape)
      max_shape = util.scalar2tensor_one(max_shape)
      util.check_kernel_name(kernel_name)
      util.check_shape_rule(input_shape)
      util.check_shape_rule(min_shape, 1, 1, 1)
      util.check_shape_rule(max_shape, 1, 1, 1)
      util.check_tensor_shape_size(input_shape)
      util.check_tensor_shape_size(min_shape)
      util.check_tensor_shape_size(max_shape)
  
      check_list = ["float32", "float16"]
      x_dtype = input_dtype.lower()
      min_dtype = min_dtype.lower()
      max_dtype = max_dtype.lower()
      util.check_dtype_rule(x_dtype, check_list)
      util.check_dtype_rule(min_dtype, check_list)
      util.check_dtype_rule(max_dtype, check_list)
  
      input_shape = (functools_reduce(lambda x, y: x * y, input_shape[:]),)
      shape_min, _, _ = util.produce_shapes(min_shape, input_shape)
  
      input_data = tvm.placeholder(input_shape, name="x", dtype=x_dtype)
      min_data = tvm.placeholder(shape_min, name="min_data", dtype=min_dtype)
      max_data = tvm.placeholder(shape_min, name="max_data", dtype=max_dtype)
      res_list = minmax_update_perlayer_compute(input_data, min_data, max_data, ema, ema_decay)
  
      with tvm.target.cce():
          sch = generic.auto_schedule(res_list)
  
      tensor_list = [input_data, min_data, max_data] + list(res_list)
      config = {"print_ir": False,
                "name": kernel_name,
                "tensor_list": tensor_list}
  
      te.lang.cce.cce_build_code(sch, config)
function_tokens: def minmax_update_perlayer ( x , min_val , max_val , min_up , max_up , ema , ema_decay , kernel_name = "minmax_update_perlayer" ) : input_shape = x . get ( "shape" ) input_dtype = x . get ( "dtype" ) min_shape = min_val . get ( "ori_shape" ) min_dtype = min_val . get ( "dtype" ) max_shape = max_val . get ( "ori_shape" ) max_dtype = max_val . get ( "dtype" ) min_shape = util . scalar2tensor_one ( min_shape ) max_shape = util . scalar2tensor_one ( max_shape ) util . check_kernel_name ( kernel_name ) util . check_shape_rule ( input_shape ) util . check_shape_rule ( min_shape , 1 , 1 , 1 ) util . check_shape_rule ( max_shape , 1 , 1 , 1 ) util . check_tensor_shape_size ( input_shape ) util . check_tensor_shape_size ( min_shape ) util . check_tensor_shape_size ( max_shape ) check_list = [ "float32" , "float16" ] x_dtype = input_dtype . lower ( ) min_dtype = min_dtype . lower ( ) max_dtype = max_dtype . lower ( ) util . check_dtype_rule ( x_dtype , check_list ) util . check_dtype_rule ( min_dtype , check_list ) util . check_dtype_rule ( max_dtype , check_list ) input_shape = ( functools_reduce ( lambda x , y : x * y , input_shape [ : ] ) , ) shape_min , _ , _ = util . produce_shapes ( min_shape , input_shape ) input_data = tvm . placeholder ( input_shape , name = "x" , dtype = x_dtype ) min_data = tvm . placeholder ( shape_min , name = "min_data" , dtype = min_dtype ) max_data = tvm . placeholder ( shape_min , name = "max_data" , dtype = max_dtype ) res_list = minmax_update_perlayer_compute ( input_data , min_data , max_data , ema , ema_decay ) with tvm . target . cce ( ) : sch = generic . auto_schedule ( res_list ) tensor_list = [ input_data , min_data , max_data ] + list ( res_list ) config = { "print_ir" : False , "name" : kernel_name , "tensor_list" : tensor_list } te . lang . cce . cce_build_code ( sch , config )