code: def test_multi_freedim_output_udf():
      dim = 2
      x = C.sequence.input_variable(dim, needs_gradient=True, name="x")
      y = C.sequence.input_variable(dim, needs_gradient=True, name="y")
      op = C.user_function(MultiFreeDimensionOutputUserFunction(x, y))
  
      x_data = [AA([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32)]
      y_data = [AA([[5.0, 6.0], [7.0, 8.0]], dtype=np.float32)]
      result = op.eval({x: x_data, y: y_data})
      assert np.allclose(
          result[op.outputs[0]], x_data[0] + 2 * y_data[0]
      )
      assert np.allclose(
          result[op.outputs[1]], 2 * x_data[0] + y_data[0]
      )
  
      op = op.outputs[0] + op.outputs[1]
      gradients = op.grad({x: x_data, y: y_data}, op.arguments)
      assert np.allclose(
          gradients[op.arguments[0]], [[[3.0, 3.0], [3.0, 3.0]]]
      )
      assert np.allclose(
          gradients[op.arguments[1]], [[[3.0, 3.0], [3.0, 3.0]]]
      )
  
imports: import numpy
  import pytest
  import cntk
  from cntk.ops.functions import Function, UserFunction
  from .ops_test_utils import AA
label_desc: Use image node_id 12 for calling a global function with example usage: test_multi_freedim_output_udf() without return types