code: def dense_layer(inp, output_dim, nonlinearity):
      r = linear_layer(inp, output_dim)
      r = nonlinearity(r)
      if isinstance(r, UserFunction):
          r = C.user_function(r)
      return r
  
imports: from __future__ import division, print_function
  import numpy
  import cntk
  from cntk.ops.tests.ops_test_utils import cntk_device, mem_used, os_process
  from cntk.ops.functions import UserFunction
  from cntk import sigmoid
label_desc: Use image node_id 3 for calling a global function with example usage: dense_layer(inp, output_dim, nonlinearity) and returns: r