class_docstr: Class containing tests for InternalTorchIR optimization passes.
code: def test_inpace_op_from_cast():
      class Net(torch.nn.Module):
          def forward(self, x):
              y = torch.empty(x.shape).to(torch.int32)
              y.fill_(0.2)
              return y
  
      shape = (2, 3)
      x = torch.rand(*shape)
      traced_fn = torch.jit.trace(Net(), x).eval()
  
      ct_model = ct.convert(
          traced_fn,
          inputs=[ct.TensorType(shape=shape)],
          outputs=[ct.TensorType(name="y", dtype=np.int32)],
          source="pytorch",
      )
      y_cm = ct_model.predict({"x": x})["y"]
  
      assert (y_cm == np.zeros(shape)).all()
  
file_path: coremltools/coremltools/converters/mil/frontend/torch/test/test_passes.py
imports: from collections import OrderedDict
  import numpy
  import pytest
  import torch
  from ..internal_graph import InternalTorchIRBlock, InternalTorchIRGraph, InternalTorchIRNode
  from ..torchir_passes import flatten_graph_input_values, flatten_graph_output_values, transform_inplace_ops
  import coremltools
label_desc: Use image node_id 7 for calling the TestTorchPasses obj's underlying member method code with example usage: obj.test_inpace_op_from_cast() and returns: y