code: def test_grad_after_eval():
      x = C.input_variable((C.FreeDimension, 2))
      w = C.parameter(
          init=np.asarray([[2, 5], [1, 3]], dtype=np.float32)
      )
      t = C.times(x, w)
  
      x_data = np.asarray([[0.5, 0.2]], np.float32)
      t_val = t.eval({x: x_data})
      assert np.array_equal(
          t_val, np.asarray([[[1.2, 3.1]]], dtype=np.float32)
      )
  
      w_grad, t_val = t.grad({x: x_data}, wrt=[w], outputs=[t])
      assert np.array_equal(
          t_val, np.asarray([[[1.2, 3.1]]], dtype=np.float32)
      )
      assert np.array_equal(
          w_grad, np.asarray([[0.5, 0.5], [0.2, 0.2]], dtype=np.float32)
      )
  
      x_data = np.asarray([[0.5, 0.2], [0.1, 0.6]], np.float32)
      t_val = t.eval({x: x_data})
      assert np.allclose(
          t_val,
          np.asarray([[[1.2, 3.1], [0.8, 2.3]]], dtype=np.float32),
      )
  
      w_grad, t_val = t.grad({x: x_data}, wrt=[w], outputs=[t])
      assert np.allclose(
          t_val,
          np.asarray([[[1.2, 3.1], [0.8, 2.3]]], dtype=np.float32),
      )
      assert np.array_equal(
          w_grad, np.asarray([[0.6, 0.6], [0.8, 0.8]], dtype=np.float32)
      )
  
file_path: CNTK/bindings/python/cntk/ops/tests/evaluation_test.py
imports: from __future__ import division
  import numpy
  import pytest
  from .ops_test_utils import _test_binary_op, AA, precision, PRECISION_TO_TYPE, unittest_helper
  from cntk import dropout, combine
  import cntk
label_desc: Use image node_id 7 for calling a global function with example usage: test_grad_after_eval() without return types