code: def check_amp_net_stats(
      lp_dtype,
      net,
      data_example,
      lp16_tensors_num,
      lp16_casts_num,
      other_casts_num,
  ):
      lp16_tensors = set()
      lp16_casts = set()
      other_casts = set()
  
      def inspect_output(tensor_name, op_name, tensor):
          dtype = mx.nd.get_dtype_name(tensor.dtype)
          if op_name == "amp_cast":
              if dtype == lp_dtype:
                  lp16_casts.add(tensor_name)
              else:
                  other_casts.add(tensor_name)
          if dtype == lp_dtype:
              lp16_tensors.add(tensor_name)
  
      net.register_op_hook(inspect_output)
      net(data_example)
  
      assert (
          len(lp16_tensors) == lp16_tensors_num
      ), f"Bad lp16 tensors! Present tensors: {sorted(lp16_tensors)}"
      assert (
          len(lp16_casts) == lp16_casts_num
      ), f"Bad lp16 casts! Present casts: {sorted(lp16_casts)}"
      assert (
          len(other_casts) == other_casts_num
      ), f"Bad casts! Present casts: {sorted(other_casts)}"
  
file_path: mxnet/tests/python/amp/common.py
imports: import warnings
  import collections
  import mxnet
  from mxnet import amp
  from mxnet.gluon import nn
  from mxnet.operator import get_all_registered_operators_grouped
label_desc: Use image node_id 7 for calling a global function with example usage: check_amp_net_stats(lp_dtype, net, data_example, lp16_tensors_num, lp16_casts_num, other_casts_num) without return types