code: def test_change_truediv_to_mul_by_inverse():
      _, traced = get_bert_model()
  
      orig_num_truediv = sum(
          (
              1 if node.target == operator.truediv else 0
              for node in traced.graph.nodes
          )
      )
      orig_num_mul = sum(
          (
              1 if node.target == operator.mul else 0
              for node in traced.graph.nodes
          )
      )
  
      transformation = ChangeTrueDivToMulByInverse()
      transformed = transformation(traced)
  
      num_truediv = sum(
          (
              1 if node.target == operator.truediv else 0
              for node in transformed.graph.nodes
          )
      )
      num_mul = sum(
          (
              1 if node.target == operator.mul else 0
              for node in transformed.graph.nodes
          )
      )
  
      assert (orig_num_truediv != num_truediv) and (
          orig_num_mul != num_mul
      )
      assert orig_num_truediv - num_truediv == num_mul - orig_num_mul
  
      restored = transformation(traced, reverse=True)
  
      restored_num_truediv = sum(
          (
              1 if node.target == operator.truediv else 0
              for node in restored.graph.nodes
          )
      )
      restored_num_mul = sum(
          (
              1 if node.target == operator.mul else 0
              for node in restored.graph.nodes
          )
      )
  
      assert (orig_num_truediv == restored_num_truediv) and (
          orig_num_mul == restored_num_mul
      )
  
imports: import operator
  import unittest
  import torch
  from parameterized import parameterized
  from transformers import AutoModel, AutoModelForImageClassification, AutoTokenizer, BertModel
  from transformers.models.bert.modeling_bert import BertSelfAttention
  from transformers.utils.fx import symbolic_trace
  from optimum.fx.optimization import ChangeTrueDivToMulByInverse, FuseBatchNorm1dInLinear, FuseBatchNorm2dInConv2d, FuseBiasInLinear, MergeLinears, ReversibleTransformation, Transformation, compose
  from optimum.fx.utils import are_fx_features_available
label_desc: Use image node_id 4 for calling a global function with example usage: test_change_truediv_to_mul_by_inverse() without return types