code: def create_filter_anchor_source(shapes):
      rng = np.random.default_rng(42)
  
      def source(sample_info):
          shape_idx = sample_info.idx_in_batch % len(shapes)
          shape = shapes[shape_idx]
          anchor = np.int32(rng.uniform(0, shape))
          for dim in range(len(anchor)):
              if rng.uniform(0, 4) >= 3:
                  anchor[dim] = -1
          anchor = np.array(anchor, dtype=np.int32)
          return filter_enumerated(shape), anchor
  
      return source
  
file_path: DALI/dali/test/python/operator_2/test_filter.py
imports: import itertools
  import os
  import numpy
  from nvidia.dali import pipeline_def, fn, types
  from test_utils import get_dali_extra_path, np_type_to_dali, check_batch
  from nose2.tools import params
  from nose.plugins.attrib import attr
  from filter_test_utils import filter_baseline, filter_baseline_layout
label_desc: Use image node_id 2 for calling a global function with example usage: create_filter_anchor_source(shapes) and returns: source, filter_enumerated,  anchor