code: def convert_to_mixed_precision(
      mod, ops=None, calculation_type="float16", acc_type="float16"
  ):
      """Converts the operator datatypes
  
      Parameters
      ----------
      mod : tvm.IRModule
          The relay module to convert.
      ops : list
          List of operators to be precision converted.
      calculation_type: str
          Input precision to be used.
      acc_type: str
          Output or accumulation precision to be used.
  
      Returns
      -------
      mod : tvm.IRModule
          The converted module.
      """
  
      if ops is None:
          ops = ["nn.conv2d", "nn.dense"]
  
      with MixedPrecision(ops, acc_type):
          seq = transform.Sequential(
              [
                  relay.transform.InferType(),
                  relay.transform.ToMixedPrecision(calculation_type),
              ]
          )
          with transform.PassContext(
              config={
                  "relay.ToMixedPrecision.keep_orig_output_dtype": True
              },
              opt_level=3,
          ):
              try:
                  return seq(mod)
              except Exception as err:
                  raise TVMCException(
                      "Error converting mixed precision : {0}".format(
                          str(err)
                      )
                  )
  
file_path: tvm/python/tvm/driver/tvmc/transform.py
imports: from tvm import relay, transform
  from tvm.driver.tvmc import TVMCException
label_desc: Use image node_id 2 for calling a global function with example usage: convert_to_mixed_precision(mod, ops, calculation_type, acc_type) and returns: seq