code: def test_amp_offline_casting(lp_dtype):
      class TestNet(nn.HybridBlock):
          def __init__(self):
              super().__init__()
              self.lp16_op1 = nn.Conv2D(4, 3)
              self.lp16_op2 = nn.Conv2DTranspose(4, 3)
              self.fp32_op = nn.Dense(4)
  
          def forward(self, x):
              x = self.lp16_op1(x)
              x = self.lp16_op2(x)
              x = x.reshape(x.shape[0], -1)
              with nn.HybridBlock.OptConstraint.disable_amp():
                  x = self.fp32_op(x)
              return x
  
      net = TestNet()
      net.initialize()
      data_example = mx.np.random.uniform(-1, 1, (4, 3, 16, 16))
      lp_net = amp.convert_hybrid_block(
          net, data_example, lp_dtype, cast_params_offline=True
      )
  
      check_amp_net_stats(
          lp_dtype,
          lp_net,
          data_example,
          lp16_tensors_num=4,
          lp16_casts_num=1,
          other_casts_num=1,
      )
      for name, data in lp_net.collect_params().items():
          assert mx.nd.get_dtype_name(data.dtype) == (
              "float32" if "fp32_op" in name else lp_dtype
          )
  
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 3 for calling a global function with example usage: test_amp_offline_casting(lp_dtype) and returns: x