code: def convert_to_native_binary_convolution(model):
      """
      Clones a binary convolution network, sharing the original parameters
      but substitutes the python 'BinaryConvolution' Function instances
      used during training with faster C++ NativeBinaryConvolveFunction
      instances that uses optimized binary convolution implementations
      generated using the Halide framework
  
      Args:
          model   : model that needs convolutions to be substituted.
  
      Returns:
          A model with Halid operators.
      """
      if not C.contrib.netopt.native_convolve_function_registered:
          raise Exception(
              "Could not find {0} library. "
              "Please check if HALIDE_PATH is configured properly "
              "and try building {1} again".format(
                  "Cntk.BinaryConvolution-" + C.__version__.rstrip("+"),
                  "Extnsibiliy\\BinaryConvolution",
              )
          )
  
      bin_conv_filter = (
          lambda m: type(m) == C.Function
          and m.is_block
          and m.op_name == "BinaryConvolution"
      )
  
      def bin_converter(x):
          att = x.block_root.attributes
          # Need a square filter.
          assert x.inputs[0].shape[-1] == x.inputs[0].shape[-2]
  
          # These are the attributes needed for the native convolution layer
          # names are defined in BinaryConvolveOp.h
          attributes = {
              "stride": att["strides"][-1],
              "padding": att["autoPadding"][-1],
              "size": x.inputs[0].shape[-1],
              "h": x.inputs[1].shape[1],
              "w": x.inputs[1].shape[2],
              "channels": x.inputs[1].shape[0],
              "filters": x.inputs[0].shape[0],
          }
  
          return C.ops.native_user_function(
              "NativeBinaryConvolveFunction",
              list(x.inputs),
              attributes,
              "NativeBinaryConvolution",
          )
  
      return C.misc.convert(model, bin_conv_filter, bin_converter)
  
imports: import cntk
  from cntk.contrib.netopt.custom_convolution_ops import *
label_desc: Use image node_id 2 for calling a global function with example usage: convert_to_native_binary_convolution(model) and returns: C, C