code: def test_error_condition():
      kwargs = {
          "enable_conditionals": True,
          "batch_size": 10,
          "num_threads": 4,
          "device_id": 0,
      }
  
      @experimental.pipeline_def(**kwargs)
      def gpu_condition():
          pred = fn.random.coin_flip(dtype=types.DALIDataType.BOOL)
          # We have to create a new, pure GPU node, otherwise we still find the CPU node.
          if pred.gpu() | False:
              output = np.array(1)
          else:
              output = np.array(0)
          return output
  
      # TODO(klecki): Extend the error checking so we can provide better error message here.
      with assert_raises(
          RuntimeError,
          glob=(
              "Named arguments inputs to operators must be CPU data nodes."
              " However, a GPU data node was provided"
          ),
      ):
          pipe = gpu_condition()
          pipe.build()
          print(pipe.run())
  
      @experimental.pipeline_def(**kwargs)
      def non_scalar_condition():
          pred = fn.random.coin_flip(dtype=types.DALIDataType.BOOL)
          stacked = fn.stack(pred, pred)
          if stacked:
              output = np.array(1)
          else:
              output = np.array(0)
          return output
  
      with assert_raises(
          RuntimeError,
          glob=(
              "Conditions inside `if` statements are restricted to scalar"
              " (0-d tensors) inputs, that are placed on CPU."
              " Got a 1-d input as a condition of the `if` statement."
          ),
      ):
          pipe = non_scalar_condition()
          pipe.build()
          pipe.run()
  
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 41 for calling a global function with example usage: test_error_condition() and returns: output, output