def add_reshape_node(
        dag: OnnxDAG, graph_idx: int, node_name: str, input_name: str, target_shape: list[int], output_elem_type: int
    ) -> str:
        """Add a reshape node to the graph.

        :param dag: The OnnxDAG object.
        :param graph_idx: The index of the graph.
        :param node_name: The name of the node.
        :param input_name: The name of the input tensor.
        :param target_shape: The target shape for the reshape operation.
        :param output_elem_type: The element type of the output tensor.
        :return: The name of the output tensor after reshaping.
        """
        # need to reshape the first input to 2D
        reshape_shape_name = f"{node_name}_shape"
        reshape_output_name = f"{node_name}_output"
        dag.add_initializer(
            onnx.numpy_helper.from_array(np.array(target_shape, dtype=np.int64), reshape_shape_name), graph_idx
        )
        dag.add_node(
            onnx.helper.make_node(
                "Reshape",
                [input_name, reshape_shape_name],
                [reshape_output_name],
                name=node_name,
            ),
            graph_idx,
        )
        dag.add_value_info(
            onnx.helper.make_tensor_value_info(
                reshape_output_name,
                output_elem_type,
                target_shape,
            ),
            graph_idx,
        )
        return reshape_output_name
Add a reshape node to the graph.

        :param dag: The OnnxDAG object.
        :param graph_idx: The index of the graph.
        :param node_name: The name of the node.
        :param input_name: The name of the input tensor.
        :param target_shape: The target shape for the reshape operation.
        :param output_elem_type: The element type of the output tensor.
        :return: The name of the output tensor after reshaping.
        
olive/passes/onnx/graph_surgeries.py