code: def test_symbol_block_fp16(tmpdir):
      # Test case to verify if initializing the SymbolBlock from a model with params
      # other than fp32 param dtype.
  
      # 1. Load a resnet model, cast it to fp16 and export
      tmp = str(tmpdir)
      tmpfile = os.path.join(tmp, "resnet34_fp16")
      device = mx.gpu(0)
  
      net_fp32 = mx.gluon.model_zoo.vision.resnet34_v2(
          pretrained=True, device=device, root=tmp
      )
      net_fp32.cast("float16")
      net_fp32.hybridize()
      data = mx.np.zeros(
          (1, 3, 224, 224), dtype="float16", device=device
      )
      net_fp32(data)
      symbol_file, param_file = net_fp32.export(tmpfile, 0)
  
      # 2. Load the saved model and verify if all the params are loaded correctly.
      # Choose one of the parameters to verify the type is fp16.
      sm = mx.sym.load(symbol_file)
      inputs = mx.sym.var("data", dtype="float16")
      net_fp16 = mx.gluon.SymbolBlock(sm, inputs)
      net_fp16.load_parameters(param_file, device=device)
      # 3. Get a conv layer's weight parameter name. Conv layer's weight param is
      # expected to be of dtype casted, fp16.
      name = None
      for param_name in net_fp32.collect_params().keys():
          if "conv" in param_name and "weight" in param_name:
              name = param_name
              break
      assert _np.dtype(net_fp16.params[name].dtype) == _np.dtype(
          _np.float16
      )
  
imports: import sys
  import os
  import time
  import random
  import mxnet
  import multiprocessing
  from mxnet.test_utils import check_consistency, set_default_device, assert_almost_equal, rand_ndarray, environment
  import numpy
  import math
  from mxnet import autograd
  import pytest
  from common import assert_raises_cudnn_not_satisfied, run_in_spawned_process, random_seed
  from test_gluon import *
  from test_loss import *
  from test_numpy_loss import *
  from test_gluon_rnn import *
label_desc: Use image node_id 16 for calling a global function with example usage: test_symbol_block_fp16(tmpdir) without return types