docstr: Input:
      main(%x: (1, 3, 20, fp32)(Tensor)) {
        block0() {
          %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1!")
        } -> (%var_1!)
      }
  
      main_2(%x: (1, 3, 20, fp32)(Tensor)) {
        block0() {
          %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1!")
        } -> (%var_1!)
      }
  
  
  Output:
      main(%x: (1, 3, 20, fp32)(Tensor)) {
        block0() {
          %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1_")
        } -> (%var_1_)
      }
  
      main_2(%x: (1, 3, 20, fp32)(Tensor)) {
        block0() {
          %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1_")
        } -> (%var_1_)
      }
docstr_tok: ["Input",":","main","(","%","x",":","(","1",",","3",",","20",",","fp32",")","(","Tensor",")",")","{","block0","(",")","{","%","var_1","!",":","(","1",",","3",",","20",",","fp32",")","(","Tensor",")","=","relu","(","x=","%","x",",","name=","''","var_1","!","''",")","}","-",">","(","%","var_1","!",")","}","main_2","(","%","x",":","(","1",",","3",",","20",",","fp32",")","(","Tensor",")",")","{","block0","(",")","{","%","var_1","!",":","(","1",",","3",",","20",",","fp32",")","(","Tensor",")","=","relu","(","x=","%","x",",","name=","''","var_1","!","''",")","}","-",">","(","%","var_1","!",")","}","Output",":","main","(","%","x",":","(","1",",","3",",","20",",","fp32",")","(","Tensor",")",")","{","block0","(",")","{","%","var_1","!",":","(","1",",","3",",","20",",","fp32",")","(","Tensor",")","=","relu","(","x=","%","x",",","name=","''","var_1_","''",")","}","-",">","(","%","var_1_",")","}","main_2","(","%","x",":","(","1",",","3",",","20",",","fp32",")","(","Tensor",")",")","{","block0","(",")","{","%","var_1","!",":","(","1",",","3",",","20",",","fp32",")","(","Tensor",")","=","relu","(","x=","%","x",",","name=","''","var_1_","''",")","}","-",">","(","%","var_1_",")","}"]
code: def test_sanitize_var_names_with_two_functions(self):
      """
      Input:
          main(%x: (1, 3, 20, fp32)(Tensor)) {
            block0() {
              %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1!")
            } -> (%var_1!)
          }
  
          main_2(%x: (1, 3, 20, fp32)(Tensor)) {
            block0() {
              %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1!")
            } -> (%var_1!)
          }
  
  
      Output:
          main(%x: (1, 3, 20, fp32)(Tensor)) {
            block0() {
              %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1_")
            } -> (%var_1_)
          }
  
          main_2(%x: (1, 3, 20, fp32)(Tensor)) {
            block0() {
              %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1_")
            } -> (%var_1_)
          }
  
      """
  
      @mb.program(input_specs=[mb.TensorSpec(shape=(1, 3, 20))])
      def prog(x):
          z = mb.relu(x=x, name="var_1!")
          return z
  
      @mb.program(input_specs=[mb.TensorSpec(shape=(1, 3, 20))])
      def prog_2(x):
          z = mb.relu(x=x, name="var_1!")
          return z
  
      prog.add_function("main_2", prog_2.functions["main"])
      PASS_REGISTRY["mil_backend::sanitize_name_strings"](prog)
      block = prog.functions["main"]
      assert (
          block.find_ops(op_type="relu")[0].outputs[0].name == "var_1_"
      )
      assert prog["main"].outputs[0].name == "var_1_"
      assert block.find_ops(op_type="relu")[0].name == "var_1_"
      block = prog.functions["main_2"]
      assert (
          block.find_ops(op_type="relu")[0].outputs[0].name == "var_1_"
      )
      assert prog["main"].outputs[0].name == "var_1_"
      assert block.find_ops(op_type="relu")[0].name == "var_1_"
  
imports: import copy
  import itertools
  import numpy
  import pytest
  import coremltools
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.passes.pass_registry import PASS_REGISTRY
  from coremltools.converters.mil.testing_utils import apply_pass_and_basic_check, assert_model_is_valid, get_op_types_in_program
label_desc: Use image node_id 2 for calling the TestSanitizerPass obj's underlying member method code with example usage: obj.test_sanitize_var_names_with_two_functions() and returns: z, z