original_docstring: Map MXNet's Reshape operator attributes to onnx's Reshape operator.
      Converts output shape attribute to output shape tensor
      and return multiple created nodes.
      
docstring: Map MXNet's Reshape operator attributes to onnx's Reshape operator.
  Converts output shape attribute to output shape tensor
  and return multiple created nodes.
docstring_tokens: Map MXNet ' s Reshape operator attributes to onnx ' s Reshape operator . Converts output shape attribute to output shape tensor and return multiple created nodes .
code: def convert_reshape(node, **kwargs):
      """Map MXNet's Reshape operator attributes to onnx's Reshape operator.
      Converts output shape attribute to output shape tensor
      and return multiple created nodes.
      """
      onnx = import_onnx_modules()
      name = node["name"]
      proc_nodes = kwargs["proc_nodes"]
      inputs = node["inputs"]
      attrs = node["attrs"]
  
      output_shape_list = convert_string_to_list(attrs["shape"])
  
      initializer = kwargs["initializer"]
      output_shape_np = np.array(output_shape_list)
      data_type = onnx.mapping.NP_TYPE_TO_TENSOR_TYPE[output_shape_np.dtype]
      dims = np.shape(output_shape_np)
  
      output_shape_name = "reshape_attr_tensor" + str(kwargs["idx"])
      tensor_node = onnx.helper.make_tensor_value_info(output_shape_name, data_type, dims)
  
      initializer.append(
          onnx.helper.make_tensor(
              name=output_shape_name,
              data_type=data_type,
              dims=dims,
              vals=output_shape_list,
              raw=False,
          )
      )
  
      input_node_idx = kwargs["index_lookup"][inputs[0][0]]
      input_node_name = proc_nodes[input_node_idx].name
  
      not_supported_shape = [-2, -3, -4]
  
      for val in output_shape_list:
          if val in not_supported_shape:
              raise AttributeError("Shape value not supported in ONNX", val)
  
      reshape_node = onnx.helper.make_node(
          "Reshape",
          [input_node_name, output_shape_name],
          [name],
          name=name
      )
  
      return [tensor_node, reshape_node]
code_tokens: def convert_reshape ( node , ** kwargs ) : onnx = import_onnx_modules ( ) name = node [ "name" ] proc_nodes = kwargs [ "proc_nodes" ] inputs = node [ "inputs" ] attrs = node [ "attrs" ] output_shape_list = convert_string_to_list ( attrs [ "shape" ] ) initializer = kwargs [ "initializer" ] output_shape_np = np . array ( output_shape_list ) data_type = onnx . mapping . NP_TYPE_TO_TENSOR_TYPE [ output_shape_np . dtype ] dims = np . shape ( output_shape_np ) output_shape_name = "reshape_attr_tensor" + str ( kwargs [ "idx" ] ) tensor_node = onnx . helper . make_tensor_value_info ( output_shape_name , data_type , dims ) initializer . append ( onnx . helper . make_tensor ( name = output_shape_name , data_type = data_type , dims = dims , vals = output_shape_list , raw = False , ) ) input_node_idx = kwargs [ "index_lookup" ] [ inputs [ 0 ] [ 0 ] ] input_node_name = proc_nodes [ input_node_idx ] . name not_supported_shape = [ - 2 , - 3 , - 4 ] for val in output_shape_list : if val in not_supported_shape : raise AttributeError ( "Shape value not supported in ONNX" , val ) reshape_node = onnx . helper . make_node ( "Reshape" , [ input_node_name , output_shape_name ] , [ name ] , name = name ) return [ tensor_node , reshape_node ]
short_docstring: Map MXNet's Reshape operator attributes to onnx's Reshape operator.
short_docstring_tokens: Map MXNet ' s Reshape operator attributes to onnx ' s Reshape operator .
comment: """Map MXNet's Reshape operator attributes to onnx's Reshape operator.
      Converts output shape attribute to output shape tensor
      and return multiple created nodes.
      """