class_docstr: Setup CNTK ops with given parameters
class_docstr_tok: ["Setup","CNTK","ops","with","given","parameters"]
docstr:  Setup convolution op with given parameters
  
  Args:
      cntk_layer (:class:`~cntk.contrib.crosstalkcaffe.unimodel.cntkmodel.CntkLayersDefinition`):
          the layer definition of convolution op
      inputs (list): a list contains all :class:`~cntk.ops.functions.Function` or
          :class:`~cntk.input`
  
  Return:
      :func:`~cntk.ops.functions.Function`: instaced cntk convolution op
docstr_tok: ["Setup","convolution","op","with","given","parameters","Args",":","cntk_layer","(",":","class",":","`","~cntk.contrib.crosstalkcaffe.unimodel.cntkmodel.CntkLayersDefinition","`",")",":","the","layer","definition","of","convolution","op","inputs","(","list",")",":","a","list","contains","all",":","class",":","`","~cntk.ops.functions.Function","`","or",":","class",":","`","~cntk.input","`","Return",":",":","func",":","`","~cntk.ops.functions.Function","`",":","instaced","cntk","convolution","op"]
code: def convolution(cntk_layer, inputs):
      """
       Setup convolution op with given parameters
  
      Args:
          cntk_layer (:class:`~cntk.contrib.crosstalkcaffe.unimodel.cntkmodel.CntkLayersDefinition`):
              the layer definition of convolution op
          inputs (list): a list contains all :class:`~cntk.ops.functions.Function` or
              :class:`~cntk.input`
  
      Return:
          :func:`~cntk.ops.functions.Function`: instaced cntk convolution op
      """
      sanitize_input = internal.sanitize_input(inputs[0])
      params = cntk_layer.parameters
      output_channel = params.output
      kernel_size = params.kernel
      kernel_shape = (
          output_channel,
          int(sanitize_input.shape[0] / params.group),
      ) + tuple(kernel_size)
      kernel_init = None
      if cntk_layer.parameter_tensor:
          kernel_data_tensor = cntk_layer.parameter_tensor[0]
          kernel_init = np.asarray(
              kernel_data_tensor.data, dtype=np.float32
          )
          kernel_init = np.reshape(kernel_init, newshape=kernel_shape)
      bias_shape = (output_channel,) + (1,) * 2
      bias_init = None
      if params.need_bias:
          if cntk_layer.parameter_tensor:
              bias_data_tensor = cntk_layer.parameter_tensor[1]
              bias_init = np.asarray(
                  bias_data_tensor.data, dtype=np.float32
              )
              bias_init = np.reshape(bias_init, bias_shape)
      return BlockApiSetup.convolution(
          output_channel,
          kernel_size,
          stride=params.stride,
          pad=params.auto_pad,
          kernel_init=kernel_init,
          bias_init=bias_init,
          group=params.group,
          dilation=params.dilation,
          name=cntk_layer.op_name,
      )(sanitize_input)
  
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 1 for calling the ApiSetup obj's underlying member method code with example usage: obj.convolution(cntk_layer, inputs) and returns: BlockApiSetup