original_docstring: Map MXNet's LeakyReLU operator attributes to onnx's Elu/LeakyRelu/PRelu operators
      based on the input node's attributes and return the created node.
      
docstring: Map MXNet's LeakyReLU operator attributes to onnx's Elu/LeakyRelu/PRelu operators
  based on the input node's attributes and return the created node.
docstring_tokens: Map MXNet ' s LeakyReLU operator attributes to onnx ' s Elu / LeakyRelu / PRelu operators based on the input node ' s attributes and return the created node .
code: def convert_leakyrelu(node, **kwargs):
      """Map MXNet's LeakyReLU operator attributes to onnx's Elu/LeakyRelu/PRelu operators
      based on the input node's attributes and return the created node.
      """
      onnx = import_onnx_modules()
      name = node["name"]
      proc_nodes = kwargs["proc_nodes"]
      inputs = node["inputs"]
      input_node_id = kwargs["index_lookup"][inputs[0][0]]
      input_node = proc_nodes[input_node_id].name
      attrs = node["attrs"]
  
      act_type = attrs.get("act_type", "leaky")
      alpha = float(attrs.get("slope", 0.25))
  
      act_name = {"elu": "Elu", "leaky": "LeakyRelu", "prelu": "PRelu",
                  "selu": "Selu"}
  
      if act_type == "prelu":
          alpha_node_index = kwargs["index_lookup"][inputs[1][0]]
          alpha_node_name = proc_nodes[alpha_node_index].name
  
          node = onnx.helper.make_node(
              act_name[act_type],
              inputs=[input_node, alpha_node_name],
              outputs=[name],
              name=name)
      elif act_type == "selu":
          node = onnx.helper.make_node(
              act_name[act_type],
              inputs=[input_node],
              outputs=[name],
              name=name)
      else:
          node = onnx.helper.make_node(
              act_name[act_type],
              inputs=[input_node],
              outputs=[name],
              name=name,
              alpha=alpha)
  
      return [node]
code_tokens: def convert_leakyrelu ( node , ** kwargs ) : onnx = import_onnx_modules ( ) name = node [ "name" ] proc_nodes = kwargs [ "proc_nodes" ] inputs = node [ "inputs" ] input_node_id = kwargs [ "index_lookup" ] [ inputs [ 0 ] [ 0 ] ] input_node = proc_nodes [ input_node_id ] . name attrs = node [ "attrs" ] act_type = attrs . get ( "act_type" , "leaky" ) alpha = float ( attrs . get ( "slope" , 0.25 ) ) act_name = { "elu" : "Elu" , "leaky" : "LeakyRelu" , "prelu" : "PRelu" , "selu" : "Selu" } if act_type == "prelu" : alpha_node_index = kwargs [ "index_lookup" ] [ inputs [ 1 ] [ 0 ] ] alpha_node_name = proc_nodes [ alpha_node_index ] . name node = onnx . helper . make_node ( act_name [ act_type ] , inputs = [ input_node , alpha_node_name ] , outputs = [ name ] , name = name ) elif act_type == "selu" : node = onnx . helper . make_node ( act_name [ act_type ] , inputs = [ input_node ] , outputs = [ name ] , name = name ) else : node = onnx . helper . make_node ( act_name [ act_type ] , inputs = [ input_node ] , outputs = [ name ] , name = name , alpha = alpha ) return [ node ]
short_docstring: Map MXNet's LeakyReLU operator attributes to onnx's Elu/LeakyRelu/PRelu operators
  based on the input node's attributes and return the created node.
short_docstring_tokens: Map MXNet ' s LeakyReLU operator attributes to onnx ' s Elu / LeakyRelu / PRelu operators based on the input node ' s attributes and return the created node .
comment: """Map MXNet's LeakyReLU operator attributes to onnx's Elu/LeakyRelu/PRelu operators
      based on the input node's attributes and return the created node.
      """