parameters: (node, **kwargs)
docstring: Helper function to convert weights and inputs.
docstring_summary: Helper function to convert weights and inputs.
docstring_tokens: Helper function to convert weights and inputs .
function: def convert_weights_and_inputs(node, **kwargs):
      """Helper function to convert weights and inputs.
      """
      name, _, _ = get_inputs(node, kwargs)
      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)
  
          from onnx import numpy_helper
          tensor = numpy_helper.from_array(np_arr, name=name)
          initializer.append(tensor)
  
          return [tensor_node], (np_arr.dtype,)
      else:
          dtype_t = kwargs["in_type"]
          dtype = onnx.mapping.TENSOR_TYPE_TO_NP_TYPE[dtype_t]
          tval_node = onnx.helper.make_tensor_value_info(name, dtype_t, kwargs["in_shape"])
          return [tval_node], (dtype,)
function_tokens: def convert_weights_and_inputs ( node , * * kwargs ) : name , _ , _ = get_inputs ( node , kwargs ) 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 ) from onnx import numpy_helper tensor = numpy_helper . from_array ( np_arr , name = name ) initializer . append ( tensor ) return [ tensor_node ] , ( np_arr . dtype , ) else : dtype_t = kwargs [ "in_type" ] dtype = onnx . mapping . TENSOR_TYPE_TO_NP_TYPE [ dtype_t ] tval_node = onnx . helper . make_tensor_value_info ( name , dtype_t , kwargs [ "in_shape" ] ) return [ tval_node ] , ( dtype , )