code: def test_cos():
      def cos(x):
          return nd.cos(x)
  
      def grad_grad_op(x):
          return -nd.cos(x)
  
      def grad_grad_grad_op(x):
          return nd.sin(x)
  
      for dim in range(1, 5):
          shape = rand_shape_nd(dim)
          array = random_arrays(shape)
          check_second_order_unary(array, cos, grad_grad_op)
          # TODO(kshitij12345): Remove
          check_nth_order_unary(
              array, cos, [grad_grad_op, grad_grad_grad_op], [2, 3]
          )
  
imports: import math
  import random
  from functools import reduce
  from operator import mul
  import random
  from common import xfail_when_nonstandard_decimal_separator
  import mxnet
  from mxnet import nd, autograd, gluon
  from mxnet.test_utils import assert_almost_equal, random_arrays, random_uniform_arrays, rand_shape_nd, same
label_desc: Use image node_id 2 for calling a global function with example usage: test_cos() and returns: nd, unknown, nd