code: def test_dynamic_reshape():
      def dynamic_reshape_testcases(src_shape, shape_arg, dst_shape):
          data = mx.sym.Variable("data")
          shape = mx.sym.Variable("shape")
          net = mx.sym.contrib.dynamic_reshape(data, shape)
          js = net.tojson()
          net = mx.sym.fromjson(js)
          dat_npy = np.random.rand(*src_shape)
          grad_npy = np.random.rand(*dst_shape)
          args = {
              "data": mx.nd.array(dat_npy),
              "shape": mx.nd.array(shape_arg),
          }
          args_grad = {"data": mx.nd.empty(src_shape)}
          exe = net._bind(default_device(), args, args_grad)
          exe.forward(is_train=True)
          assert (
              np.square(
                  exe.outputs[0].asnumpy() - dat_npy.reshape(dst_shape)
              ).mean()
              < 1e-7
          )
          exe.backward(out_grads=mx.nd.array(grad_npy))
          assert (
              np.square(
                  exe.grad_dict["data"].asnumpy()
                  - grad_npy.reshape(src_shape)
              ).mean()
              < 1e-7
          )
  
          # test ndarray
          X = mx.nd.random.uniform(shape=src_shape)
          Y = mx.contrib.nd.dynamic_reshape(X, mx.nd.array(shape_arg))
          assert_array_equal(Y.shape, dst_shape)
  
      test_cases = [
          [(2, 3, 5, 5), (0, -1), (2, 75)],
          [(2, 3, 5, 5), (0, 0, -1), (2, 3, 25)],
          [(5, 3, 4, 5), (0, -1, 0), (5, 15, 4)],
          [(2, 3, 5, 4), (-1, 0, 0), (8, 3, 5)],
          [(2, 3, 5, 5), (0, 0, 0, 0), (2, 3, 5, 5)],
          [(2, 4, 5, 3), (-1, 2, 2, 1), (30, 2, 2, 1)],
          [(2, 3, 5, 6), (-2,), (2, 3, 5, 6)],
          [(2, 3, 5, 6), (6, 1, -2), (6, 1, 5, 6)],
          [(2, 3, 5, 6), (-3, -3), (6, 30)],
          [(2, 3, 5, 6), (-3, -1), (6, 30)],
          [(64,), (-4, 16, 4), (16, 4)],
          [(64,), (-4, 16, -1), (16, 4)],
          [(64, 1, 2, 3), (-4, 16, -1, -2), (16, 4, 1, 2, 3)],
      ]
  
      for test_case in test_cases:
          dynamic_reshape_testcases(*test_case)
  
file_path: mxnet/tests/python/unittest/test_contrib_operator.py
imports: from __future__ import print_function
  import numpy
  import mxnet
  import random
  import itertools
  from numpy.testing import assert_allclose, assert_array_equal
  from mxnet.test_utils import *
  from common import assert_raises_cudnn_not_satisfied, xfail_when_nonstandard_decimal_separator
  import unittest
label_desc: Use image node_id 10 for calling a global function with example usage: test_dynamic_reshape() without return types