parameters: (model, filter_function = None)
return_statement: return C.misc.convert(model,convo_block_filter,  convo_block_converter)
docstring: Replace convolution functions in the model with binary convolutions.
      The function replaces the convolution function inside the 
      cntk.layers.convolution block without changing the block structure.
      The output model has python version of the binarized convolutions.
  
      Args:
          model           : model that needs to be binarized.
          filter_function : filter layers in the model to apply the binarization
                          
      Returns:
          a model with convolution functions replaced by binary convolutions.
docstring_summary: Replace convolution functions in the model with binary convolutions.
      The function replaces the convolution function inside the 
      cntk.layers.convolution block without changing the block structure.
      The output model has python version of the binarized convolutions.
docstring_tokens: Replace convolution functions in the model with binary convolutions . The function replaces the convolution function inside the cntk . layers . convolution block without changing the block structure . The output model has python version of the binarized convolutions .
function: def convert_to_binary_convolution(model, filter_function = None):
      '''
      Replace convolution functions in the model with binary convolutions.
      The function replaces the convolution function inside the 
      cntk.layers.convolution block without changing the block structure.
      The output model has python version of the binarized convolutions.
  
      Args:
          model           : model that needs to be binarized.
          filter_function : filter layers in the model to apply the binarization
                          
      Returns:
          a model with convolution functions replaced by binary convolutions.
      '''
  
      convo_block_filter = (lambda x: type(x) == C.Function 
                  and x.is_block
                  and x.op_name == 'Convolution'
                  and (filter_function(x) if filter_function else True))
      
      def convo_block_converter(block):
          
          convo_filter = (lambda x: type(x) == C.Function 
                  and not x.is_block # replace the inner function only.
                  and x.op_name == 'Convolution')               
  
          def convolution_converter(x): 
  
              assert(not x.is_block) # we replace only the function.
              attributes = x.attributes
              # the parameter W of the convolution has the shape 
              # [num filters, depth, (filter shape)]
              num_filters = x.W.shape[0]
              depth = x.W.shape[1]
              filter_shape = (x.W.shape[-2], x.W.shape[-1])
                
              strides = attributes["strides"][-1]
              # check for squre strides for now.
              assert(strides == attributes["strides"][-2]) 
          
              padding =attributes["autoPadding"]
              pad = padding[-1]        
              # Checking for the last two elements in the padding vector. 
              assert(pad == padding[-2])
            
              return  binary_convolution(
                      filter_shape, 
                      num_filters = num_filters, 
                      channels = depth, 
                      strides=strides, 
                      pad = pad,          
                      name='BinaryConvolution')(block.inputs[-1])
  
          return C.misc.convert(C.as_composite(block.block_root), 
                                convo_filter, 
                                convolution_converter)
      
      return C.misc.convert(model,convo_block_filter,  convo_block_converter)
function_tokens: def convert_to_binary_convolution ( model , filter_function = None ) : convo_block_filter = ( lambda x : type ( x ) == C . Function and x . is_block and x . op_name == 'Convolution' and ( filter_function ( x ) if filter_function else True ) ) def convo_block_converter ( block ) : convo_filter = ( lambda x : type ( x ) == C . Function and not x . is_block # replace the inner function only. and x . op_name == 'Convolution' ) def convolution_converter ( x ) : assert ( not x . is_block ) # we replace only the function. attributes = x . attributes # the parameter W of the convolution has the shape  # [num filters, depth, (filter shape)] num_filters = x . W . shape [ 0 ] depth = x . W . shape [ 1 ] filter_shape = ( x . W . shape [ - 2 ] , x . W . shape [ - 1 ] ) strides = attributes [ "strides" ] [ - 1 ] # check for squre strides for now. assert ( strides == attributes [ "strides" ] [ - 2 ] ) padding = attributes [ "autoPadding" ] pad = padding [ - 1 ] # Checking for the last two elements in the padding vector.  assert ( pad == padding [ - 2 ] ) return binary_convolution ( filter_shape , num_filters = num_filters , channels = depth , strides = strides , pad = pad , name = 'BinaryConvolution' ) ( block . inputs [ - 1 ] ) return C . misc . convert ( C . as_composite ( block . block_root ) , convo_filter , convolution_converter ) return C . misc . convert ( model , convo_block_filter , convo_block_converter )