code: def binarize_convolution(model, train_function, filter_function=None):
      """
      Replace Convolution layers in the model to Halide implementations of
      binarized convolutions.
  
      Args:
          model          : model that needs convolutions to be optimized.
          train_function : this is a two step process. First, convert the model
                           to binary convolution and next, transform it to the
                           Halide implementation. Between above steps,
                           we need to train the model to get the best results.
                           train_function provides this functionality.
          filter_function: filter layers in the model to apply the binarization.
  
      Returns:
          A model with Halid operators.
      """
      assert train_function  # needs a training function to convert.
  
      z = convert_to_binary_convolution(model)
      train_function(z)
      return convert_to_native_binary_convolution(z)
  
imports: import cntk
  from cntk.contrib.netopt.custom_convolution_ops import *
label_desc: Use image node_id 1 for calling a global function with example usage: binarize_convolution(model, train_function, filter_function) and returns: convert_to_native_binary_convolution