class_docstr: Implement some special requirement ops
class_docstr_tok: ["Implement","some","special","requirement","ops"]
docstr:  Implement LRN ops
  
  Args:
      k (int): the factor k in LRN
      n (int): the normalization radius
      alpha (float): alpha factor in LRN
      beta (float): beta factor in LRN
      name (str): the name of ops
  
  Return:
      :func:`~cntk.ops.as_block`: the function contains lrn ops
docstr_tok: ["Implement","LRN","ops","Args",":","k","(","int",")",":","the","factor","k","in","LRN","n","(","int",")",":","the","normalization","radius","alpha","(","float",")",":","alpha","factor","in","LRN","beta","(","float",")",":","beta","factor","in","LRN","name","(","str",")",":","the","name","of","ops","Return",":",":","func",":","`","~cntk.ops.as_block","`",":","the","function","contains","lrn","ops"]
code: def lrn(k, n, alpha, beta, name):
      """
       Implement LRN ops
  
      Args:
          k (int): the factor k in LRN
          n (int): the normalization radius
          alpha (float): alpha factor in LRN
          beta (float): beta factor in LRN
          name (str): the name of ops
  
      Return:
          :func:`~cntk.ops.as_block`: the function contains lrn ops
      """
  
      # @BlockFunction('lrn', name)
      # def _lrn(x):
      #     x2 = cntk.ops.square(x)
      #     x2s = cntk.ops.reshape(x2, (1, cntk.InferredDimension), 0, 1)
      #     w = cntk.ops.constant(alpha / (2 * n - 1), (1, 2 * n - 1, 1, 1), name='W')
      #     y = cntk.ops.convolution(w, x2s)
      #     # reshape back to remove the fake singleton reduction dimension
      #     b = cntk.ops.reshape(y, cntk.InferredDimension, 0, 2)
      #     den = cntk.ops.exp(beta * cntk.ops.log(k + b))
      #     apply_x = cntk.ops.element_divide(x, den)
      #     return apply_x
      @BlockFunction("lrn", name)
      def _lrn(x):
          return cntk.local_response_normalization(
              x, int(n - 1), k, alpha, beta
          )
  
      return _lrn
  
imports: from operator import mul
  from functools import reduce
  import numpy
  import cntk
  import cntk.io.transforms
  from cntk import ops, io, learners, internal
  from cntk import Trainer
  from cntk.layers.blocks import BlockFunction
label_desc: Use image node_id 3 for calling the BlockApiSetup obj's underlying member method code with example usage: obj.lrn(k, n, alpha, beta, name) and returns: _lrn, cntk