original_docstring: Helper function to convert weights and inputs.
      
docstring: Helper function to convert weights and inputs.
docstring_tokens: Helper function to convert weights and inputs .
code: def convert_weights_and_inputs(node, **kwargs):
      """Helper function to convert weights and inputs.
      """
      onnx = import_onnx_modules()
      name = node["name"]
  
      if kwargs["is_input"] is False:
          weights = kwargs["weights"]
          initializer = kwargs["initializer"]
          np_arr = weights[name]
          data_type = onnx.mapping.NP_TYPE_TO_TENSOR_TYPE[np_arr.dtype]
          dims = np.shape(np_arr)
  
          tensor_node = onnx.helper.make_tensor_value_info(name, data_type, dims)
  
          initializer.append(
              onnx.helper.make_tensor(
                  name=name,
                  data_type=data_type,
                  dims=dims,
                  vals=np_arr.flatten().tolist(),
                  raw=False,
              )
          )
  
          return [tensor_node]
      else:
          tval_node = onnx.helper.make_tensor_value_info(name, kwargs["in_type"], kwargs["in_shape"])
          return [tval_node]
code_tokens: def convert_weights_and_inputs ( node , ** kwargs ) : onnx = import_onnx_modules ( ) name = node [ "name" ] if kwargs [ "is_input" ] is False : weights = kwargs [ "weights" ] initializer = kwargs [ "initializer" ] np_arr = weights [ name ] data_type = onnx . mapping . NP_TYPE_TO_TENSOR_TYPE [ np_arr . dtype ] dims = np . shape ( np_arr ) tensor_node = onnx . helper . make_tensor_value_info ( name , data_type , dims ) initializer . append ( onnx . helper . make_tensor ( name = name , data_type = data_type , dims = dims , vals = np_arr . flatten ( ) . tolist ( ) , raw = False , ) ) return [ tensor_node ] else : tval_node = onnx . helper . make_tensor_value_info ( name , kwargs [ "in_type" ] , kwargs [ "in_shape" ] ) return [ tval_node ]
short_docstring: Helper function to convert weights and inputs.
short_docstring_tokens: Helper function to convert weights and inputs .
comment: """Helper function to convert weights and inputs.
      """