code: def test_binarization():
      z = _create_convolution_model_with_skip_level_links()
      binz = qc.convert_to_binary_convolution(z)
  
      blocks = C.logging.graph.depth_first_search(
          binz,
          (
              lambda x: type(x) == C.Function
              and x.is_block
              and x.op_name == "BinaryConvolution"
          ),
          depth=0,
      )
  
      assert (
          len(blocks) == 4
      )  # all convolution blocks should be converted.
  
      binz = qc.convert_to_binary_convolution(z, _filter)
  
      blocks = C.logging.graph.depth_first_search(
          binz,
          (
              lambda x: type(x) == C.Function
              and x.is_block
              and x.op_name == "BinaryConvolution"
          ),
          depth=0,
      )
  
      assert (
          len(blocks) == 3
      )  # now only three of them should be converted.
      assert all(b.op_name != "first_convo" for b in blocks)
  
file_path: CNTK/bindings/python/cntk/contrib/netopt/test/quantization_test.py
imports: import numpy
  import pytest
  import cntk
  import cntk.contrib.netopt.quantization
  from cntk.layers import BatchNormalization
label_desc: Use image node_id 4 for calling a global function with example usage: test_binarization() without return types