original_docstring: Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator
      and return the created node.
      
docstring: Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator
  and return the created node.
docstring_tokens: Map MXNet ' s BatchNorm operator attributes to onnx ' s BatchNormalization operator and return the created node .
code: def convert_batchnorm(node, **kwargs):
      """Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator
      and return the created node.
      """
      onnx = import_onnx_modules()
      name = node["name"]
      proc_nodes = kwargs["proc_nodes"]
      inputs = node["inputs"]
  
      attrs = node["attrs"]
      momentum = float(node.get("attrs", {}).get("momentum", 0.9))
      eps = float(attrs.get("eps", 0.001))
  
      data_idx = kwargs["index_lookup"][inputs[0][0]]
      gamma_idx = kwargs["index_lookup"][inputs[1][0]]
      beta_idx = kwargs["index_lookup"][inputs[2][0]]
      moving_mean_idx = kwargs["index_lookup"][inputs[3][0]]
      moving_var_idx = kwargs["index_lookup"][inputs[4][0]]
  
      data_node = proc_nodes[data_idx].name
      gamma_node = proc_nodes[gamma_idx].name
      beta_node = proc_nodes[beta_idx].name
  
      mov_mean_node = proc_nodes[moving_mean_idx]
      mov_mean_node = mov_mean_node.name
      mov_var_node = proc_nodes[moving_var_idx].name
  
      bn_node = onnx.helper.make_node(
          "BatchNormalization",
          [data_node,
           gamma_node,  # scale
           beta_node,  # bias
           mov_mean_node,
           mov_var_node
          ],
          [name],
          name=name,
          epsilon=eps,
          momentum=momentum,
          # MXNet computes mean and variance per feature for batchnorm
          # Default for onnx is across all spatial features. So disabling the parameter.
          spatial=0
      )
      return [bn_node]
code_tokens: def convert_batchnorm ( node , ** kwargs ) : onnx = import_onnx_modules ( ) name = node [ "name" ] proc_nodes = kwargs [ "proc_nodes" ] inputs = node [ "inputs" ] attrs = node [ "attrs" ] momentum = float ( node . get ( "attrs" , { } ) . get ( "momentum" , 0.9 ) ) eps = float ( attrs . get ( "eps" , 0.001 ) ) data_idx = kwargs [ "index_lookup" ] [ inputs [ 0 ] [ 0 ] ] gamma_idx = kwargs [ "index_lookup" ] [ inputs [ 1 ] [ 0 ] ] beta_idx = kwargs [ "index_lookup" ] [ inputs [ 2 ] [ 0 ] ] moving_mean_idx = kwargs [ "index_lookup" ] [ inputs [ 3 ] [ 0 ] ] moving_var_idx = kwargs [ "index_lookup" ] [ inputs [ 4 ] [ 0 ] ] data_node = proc_nodes [ data_idx ] . name gamma_node = proc_nodes [ gamma_idx ] . name beta_node = proc_nodes [ beta_idx ] . name mov_mean_node = proc_nodes [ moving_mean_idx ] mov_mean_node = mov_mean_node . name mov_var_node = proc_nodes [ moving_var_idx ] . name bn_node = onnx . helper . make_node ( "BatchNormalization" , [ data_node , gamma_node , beta_node , mov_mean_node , mov_var_node ] , [ name ] , name = name , epsilon = eps , momentum = momentum , spatial = 0 ) return [ bn_node ]
short_docstring: Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator
  and return the created node.
short_docstring_tokens: Map MXNet ' s BatchNorm operator attributes to onnx ' s BatchNormalization operator and return the created node .
comment: """Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator
      and return the created node.
      """$SEP$# scale$SEP$# bias$SEP$# MXNet computes mean and variance per feature for batchnorm$SEP$# Default for onnx is across all spatial features. So disabling the parameter.