code: def test_exc_symbolic():
      def symbolic(exec_backward=True, waitall=True):
          x = mx.sym.Variable("x")
          y = mx.sym.Variable("y")
          z = mx.sym.Variable("z")
          x_shape = (2, 2)
          z_shape = (3, 2)
          inputs = [x, y]
          out = mx.symbol.ElementWiseSum(*inputs, name="esum")
          out = mx.sym.dot(z, out)
          out2 = mx.sym.random.normal(
              0, -1, x_shape, ctx=default_device()
          )
          out = mx.sym.dot(out, out2)
          out = mx.sym.make_loss(out)
          arr = {
              "x": mx.nd.random.normal(
                  0, 1, x_shape, ctx=default_device()
              ),
              "y": mx.nd.random.normal(
                  0, 1, x_shape, ctx=default_device()
              ),
              "z": mx.nd.random.normal(
                  0, 1, z_shape, ctx=default_device()
              ),
          }
          arr_grad = {
              "x": mx.nd.empty(x_shape),
              "y": mx.nd.empty(x_shape),
              "z": mx.nd.empty(z_shape),
          }
          exec1 = out._bind(
              ctx=default_device(), args=arr, args_grad=arr_grad
          )
          outputs = exec1.forward()
          if exec_backward:
              exec1.backward()
              if waitall:
                  mx.nd.waitall()
              else:
                  exec1.grad_arrays[0].asnumpy()
          else:
              if waitall:
                  mx.nd.waitall()
              else:
                  outputs[0].asnumpy()
  
      pytest.raises(MXNetError, symbolic, exec_backward=False)
      pytest.raises(MXNetError, symbolic, exec_backward=True)
  
      pytest.raises(
          MXNetError, symbolic, exec_backward=False, waitall=True
      )
      pytest.raises(
          MXNetError, symbolic, exec_backward=True, waitall=True
      )
  
file_path: mxnet/tests/python/unittest/test_exc_handling.py
imports: import os
  import mxnet
  import numpy
  from mxnet import gluon
  from mxnet.gluon import nn
  from mxnet.base import MXNetError
  from mxnet.test_utils import assert_exception, default_device, set_default_device, use_np
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: test_exc_symbolic() without return types