code: def test_predicate_any_type(input_type):
      batch_size = 10
      kwargs = {
          "enable_conditionals": True,
          "batch_size": batch_size,
          "num_threads": 4,
          "device_id": 0,
      }
  
      def get_truthy_falsy(sample_info):
          if sample_info.idx_in_batch < batch_size / 2:
              return np.array(7, dtype=input_type)
          else:
              return np.array(0, dtype=input_type)
  
      @experimental.pipeline_def(**kwargs)
      def non_bool_predicate():
          predicate = fn.external_source(
              source=get_truthy_falsy, batch=False
          )
          if predicate:
              output = types.Constant(np.array(42), device="cpu")
          else:
              output = types.Constant(np.array(0), device="cpu")
          return output
  
      pipe = non_bool_predicate()
      pipe.build()
      (batch,) = pipe.run()
  
      target = [
          42 if i < batch_size / 2 else 0 for i in range(batch_size)
      ]
      check_batch(batch, target)
  
imports: from nvidia.dali.pipeline import pipeline_def, experimental
  import nvidia.dali.fn
  import nvidia.dali.types
  from nvidia.dali.types import SampleInfo
  from nvidia.dali import _conditionals
  from nvidia.dali.data_node import DataNode
  import numpy
  import os
  from test_utils import check_batch, compare_pipelines
  from nose_utils import assert_raises
  from test_utils import get_dali_extra_path
  from nose2.tools import params
  import itertools
label_desc: Use image node_id 42 for calling a global function with example usage: test_predicate_any_type(input_type) and returns: output, np, np