code: def test_value_and_grad():
      fun = lambda x: np.sum(np.sin(x) ** 2)
      dfun = grad(fun)
      dfun_both = value_and_grad(fun)
      x = npr.randn(5)
      assert not isbox(dfun_both(x)[0])
      check_equivalent(fun(x), dfun_both(x)[0])
      check_equivalent(dfun(x), dfun_both(x)[1])
  
      def fun2(x):
          return dfun_both(x)[0]
  
      check_grads(fun2)(x)
  
imports: from __future__ import absolute_import
  from builtins import range
  import warnings
  from functools import partial
  import autograd.numpy
  import autograd.numpy.random
  from autograd.test_util import check_grads, check_equivalent
  from autograd.tracer import primitive, isbox
  from autograd import grad, elementwise_grad, jacobian, value_and_grad, hessian_tensor_product, hessian, make_hvp, tensor_jacobian_product, checkpoint, make_jvp, make_ggnvp, grad_and_aux
label_desc: Use image node_id 2 for calling a global function with example usage: test_value_and_grad() and returns: dfun_both