parameters: (input_x, alpha, quant_max, channel_axis,
                                                       kernel_name="fake_learned_scale_quant_perchannel_grad_d")
return_statement: return dout_data, input_data, alpha_data, quant_max_data
docstring: Get and check FakeLearnedScaleQuantPerChannelGradD parameters
docstring_summary: Get and check FakeLearnedScaleQuantPerChannelGradD parameters
docstring_tokens: Get and check FakeLearnedScaleQuantPerChannelGradD parameters
function: def fake_learned_scale_quant_perchannel_grad_d_param(input_x, alpha, quant_max, channel_axis,
                                                       kernel_name="fake_learned_scale_quant_perchannel_grad_d"):
      """Get and check FakeLearnedScaleQuantPerChannelGradD parameters"""
      input_shape = input_x.get("shape")
      input_x_shape_ = input_x.get("ori_shape")
      input_x_format = input_x.get("format")
      input_dtype = input_x.get("dtype")
      alpha_shape = alpha.get("ori_shape")
      alpha_dtype = alpha.get("dtype")
      quant_max_shape = quant_max.get("ori_shape")
      quant_max_dtype = quant_max.get("dtype")
      # for Dense weight quant, 2d[co,ci] -> 4d[1,co,ci,1], channel_axis_ need change to 1.
      if channel_axis == 0 and input_x_shape_[0] != alpha_shape[0] and input_x_shape_[1] == alpha_shape[0]:
          channel_axis_ = 1
      else:
          channel_axis_ = channel_axis
  
      util.check_kernel_name(kernel_name)
      util.check_shape_rule(input_shape)
      util.check_shape_rule(alpha_shape, 1, 1, input_x_shape_[channel_axis_])
      util.check_shape_rule(quant_max_shape, 1, 1, 1)
      util.check_tensor_shape_size(input_shape)
      util.check_tensor_shape_size(alpha_shape)
      util.check_tensor_shape_size(quant_max_shape)
  
      check_list = ["float32", "float16"]
      input_dtype = input_dtype.lower()
      alpha_dtype = alpha_dtype.lower()
      quant_max_dtype = quant_max_dtype.lower()
      util.check_dtype_rule(input_dtype, check_list)
      util.check_dtype_rule(alpha_dtype, check_list)
      util.check_dtype_rule(quant_max_dtype, check_list)
  
      shape_c = [1] * len(input_shape)
      shape_c[channel_axis_] = alpha.get("ori_shape")[0]
      if input_x_format == "NC1HWC0" and channel_axis_ == 1:
          shape_c = alpha.get("shape")
  
      dout_data = tvm.placeholder(input_shape, name="dout", dtype=input_dtype)
      input_data = tvm.placeholder(input_shape, name="x", dtype=input_dtype)
      alpha_data = tvm.placeholder(shape_c, name="alpha_data", dtype=alpha_dtype)
      quant_max_data = tvm.placeholder(quant_max_shape, name="quant_max_data", dtype=quant_max_dtype)
      return dout_data, input_data, alpha_data, quant_max_data
function_tokens: def fake_learned_scale_quant_perchannel_grad_d_param ( input_x , alpha , quant_max , channel_axis , kernel_name = "fake_learned_scale_quant_perchannel_grad_d" ) : input_shape = input_x . get ( "shape" ) input_x_shape_ = input_x . get ( "ori_shape" ) input_x_format = input_x . get ( "format" ) input_dtype = input_x . get ( "dtype" ) alpha_shape = alpha . get ( "ori_shape" ) alpha_dtype = alpha . get ( "dtype" ) quant_max_shape = quant_max . get ( "ori_shape" ) quant_max_dtype = quant_max . get ( "dtype" ) # for Dense weight quant, 2d[co,ci] -> 4d[1,co,ci,1], channel_axis_ need change to 1. if channel_axis == 0 and input_x_shape_ [ 0 ] != alpha_shape [ 0 ] and input_x_shape_ [ 1 ] == alpha_shape [ 0 ] : channel_axis_ = 1 else : channel_axis_ = channel_axis util . check_kernel_name ( kernel_name ) util . check_shape_rule ( input_shape ) util . check_shape_rule ( alpha_shape , 1 , 1 , input_x_shape_ [ channel_axis_ ] ) util . check_shape_rule ( quant_max_shape , 1 , 1 , 1 ) util . check_tensor_shape_size ( input_shape ) util . check_tensor_shape_size ( alpha_shape ) util . check_tensor_shape_size ( quant_max_shape ) check_list = [ "float32" , "float16" ] input_dtype = input_dtype . lower ( ) alpha_dtype = alpha_dtype . lower ( ) quant_max_dtype = quant_max_dtype . lower ( ) util . check_dtype_rule ( input_dtype , check_list ) util . check_dtype_rule ( alpha_dtype , check_list ) util . check_dtype_rule ( quant_max_dtype , check_list ) shape_c = [ 1 ] * len ( input_shape ) shape_c [ channel_axis_ ] = alpha . get ( "ori_shape" ) [ 0 ] if input_x_format == "NC1HWC0" and channel_axis_ == 1 : shape_c = alpha . get ( "shape" ) dout_data = tvm . placeholder ( input_shape , name = "dout" , dtype = input_dtype ) input_data = tvm . placeholder ( input_shape , name = "x" , dtype = input_dtype ) alpha_data = tvm . placeholder ( shape_c , name = "alpha_data" , dtype = alpha_dtype ) quant_max_data = tvm . placeholder ( quant_max_shape , name = "quant_max_data" , dtype = quant_max_dtype ) return dout_data , input_data , alpha_data , quant_max_data