class_docstr: Class containing tests for InternalTorchIR optimization passes.
      
class_docstr_tok: ["Class","containing","tests","for","InternalTorchIR","optimization","passes","."]
code: def test_transform_inplace_ops_graph(self):
      # The test graph is:
      #    graph(
      #        %x : Tensor[1],
      #    ):
      #      %1 = constant[value=0]()
      #      %2 = constant[value=10]()
      #      %3 = listconstruct[](%1)
      #      %4 = append[](%3, %2)
      #      return (%3)
      graph_params = {}
      graph_inputs = OrderedDict()
      graph_inputs["x"] = torch.rand(1)
      graph_nodes = [
          InternalTorchIRNode(
              inputs=[],
              attr={"value": 0},
              outputs=["1"],
              kind="constant",
          ),
          InternalTorchIRNode(
              inputs=[],
              attr={"value": 10},
              outputs=["2"],
              kind="constant",
          ),
          InternalTorchIRNode(
              inputs=["1"],
              outputs=["3"],
              kind="listconstruct",
          ),
          InternalTorchIRNode(
              inputs=["3", "2"],
              outputs=["4"],
              kind="append",
          ),
      ]
      graph_outputs = ["3"]
      graph = InternalTorchIRGraph(
          nodes=graph_nodes,
          params=graph_params,
          inputs=graph_inputs,
          outputs=graph_outputs,
      )
      for node in graph.nodes:
          node.parent = graph
  
      transform_inplace_ops(graph)
  
      np.testing.assert_equal(len(graph.outputs), 1)
      np.testing.assert_equal(
          graph.outputs[0], graph.nodes[-1].outputs[0]
      )
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/frontend/torch/test/test_passes.py
imports: import itertools
  import numpy
  import pytest
  import torch
  from ..internal_graph import *
  from ..torchir_passes import *
label_desc: Use image node_id 4 for calling the TestTorchPasses obj's underlying member method code with example usage: obj.test_transform_inplace_ops_graph() without return types