code: def test_depth_first_search_blocks(depth, prefix_count):
      from cntk.layers import Sequential, Convolution, MaxPooling, Dense
      from cntk.default_options import default_options
  
      def Blocked_Dense(dim, activation=None):
          dense = Dense(dim, activation=activation)
  
          @C.layers.BlockFunction("blocked_dense", "blocked_dense")
          def func(x):
              return dense(x)
  
          return func
  
      with default_options(activation=C.relu):
          image_to_vec = Sequential(
              [
                  Convolution((5, 5), 32, pad=True),
                  MaxPooling((3, 3), strides=(2, 2)),
                  Dense(10, activation=None),
                  Blocked_Dense(10),
              ]
          )
  
      in1 = C.input_variable(shape=(3, 256, 256), name="image")
      img = image_to_vec(in1)
  
      found = C.logging.graph.depth_first_search(
          img, lambda x: True, depth=depth
      )
      found_str = [str(v) for v in found]
  
      assert len(found) == sum(prefix_count.values())
      for prefix, count in prefix_count.items():
          assert sum(f.startswith(prefix) for f in found_str) == count
  
file_path: CNTK/bindings/python/cntk/logging/tests/graph_test.py
imports: import numpy
  import pytest
  import cntk
  from cntk.axis import Axis
label_desc: Use image node_id 7 for calling a global function with example usage: test_depth_first_search_blocks(depth, prefix_count) and returns: func, dense