docstr: Tests automatic removal of initializers when merging graphs
code: def test_merge_drop_unnecessary_initializers_and_value_info(
      self,
  ) -> None:
      """Tests automatic removal of initializers when merging graphs"""
      ops = [helper.make_opsetid("", 10)]
  
      g = GraphProto()
      g.input.extend(
          [helper.make_tensor_value_info("x", TensorProto.FLOAT, [])]
      )
      g.output.extend(
          [helper.make_tensor_value_info("y", TensorProto.FLOAT, [])]
      )
      g.node.extend(
          [helper.make_node("Identity", inputs=["x"], outputs=["y"])]
      )
  
      g1 = GraphProto()
      g1.CopyFrom(g)
      g1.name = "g1"
      m1 = helper.make_model(
          g1, producer_name="test", opset_imports=ops
      )
      checker.check_model(m1)
  
      g2 = GraphProto()
      g2.CopyFrom(g)
      g2.name = "g2"
      g2.initializer.extend(
          [
              helper.make_tensor(
                  name="x",
                  data_type=TensorProto.FLOAT,
                  dims=(),
                  vals=[0],
              )
          ]
      )
      m2 = helper.make_model(
          g2, producer_name="test", opset_imports=ops
      )
      checker.check_model(m2)
  
      g3 = GraphProto()
      g3.CopyFrom(g)
      g3.name = "g3"
      g3.sparse_initializer.extend([_make_sparse_tensor("x")])
      m3 = helper.make_model(
          g3, producer_name="test", opset_imports=ops
      )
      checker.check_model(m3)
  
      g4 = GraphProto()
      g4.CopyFrom(g)
      g4.name = "g3"
      g4.value_info.extend(
          [helper.make_tensor_value_info("x", TensorProto.FLOAT, [])]
      )
      m4 = helper.make_model(
          g4, producer_name="test", opset_imports=ops
      )
      checker.check_model(m4)
  
      # Initializer 'x' from m1 is removed, because there is no longer an input with that name
      out_m1 = compose.merge_models(
          m1, m2, prefix1="m1/", io_map=[("y", "x")]
      )
      self.assertEqual(0, len(out_m1.graph.initializer))
  
      # Sparse initializer 'x' from m1 is removed, because there is no longer an input with that name
      out_m2 = compose.merge_models(
          m1, m3, prefix1="m1/", io_map=[("y", "x")]
      )
      self.assertEqual(0, len(out_m2.graph.initializer))
  
      # Value info 'x' from m1 is removed, because there is no longer an input with that name
      out_m3 = compose.merge_models(
          m1, m4, prefix1="m1/", io_map=[("y", "x")]
      )
      self.assertEqual(0, len(out_m3.graph.value_info))
  
imports: import unittest
  from typing import Callable, List, Optional, Sequence, Tuple
  import numpy
  from onnx import FunctionProto, GraphProto, ModelProto, NodeProto, SparseTensorProto, TensorProto, ValueInfoProto, checker, compose, helper, parser, version_converter
label_desc: Use image node_id 29 for calling the TestComposeFunctions obj's underlying member method code with example usage: obj.test_merge_drop_unnecessary_initializers_and_value_info() without return types