code: def test_python_function_pipe():
      @pipeline_def(batch_size=2, device_id=0, num_threads=4)
      def fn_pipe():
          ops_fn = ops.PythonFunction(
              lambda: np.full((10, 1), 0), num_outputs=1
          )
          zeros = ops_fn()
          # Do a narrowing assertion, as the actual type depends on the value of num_outputs
          # parameter and we do not provide overload resolution based on it
          assert isinstance(zeros, DataNode)
          # Here we try out a cast, as we don't provide overloads based on num_outputs values,
          # there is one if we don't touch the num_values.
          ones = fn.python_function(
              zeros, function=lambda x: x + np.full((10, 1), 1)
          )
          twos, zeros_2 = cast(
              Sequence[DataNode],
              fn.python_function(
                  zeros,
                  function=lambda x: (x + np.full((10, 1), 2), x),
                  num_outputs=2,
              ),
          )
          fn.python_function(zeros, function=print, num_outputs=0)
          ten_from_constant = fn.python_function(
              10, function=lambda y: y
          )
          expect_data_node(zeros, zeros_2, ones, twos)
          return zeros + twos - twos, zeros_2, ones, ten_from_constant
  
      pipe = fn_pipe()
      expect_pipeline(pipe)
      pipe.build()
      out0, out1, out2, out3 = pipe.run()
      expect_tensor_list(out0, out1, out2, out3)
      assert np.array_equal(
          np.array(out0.as_tensor()), np.full((2, 10, 1), 0)
      )
      assert np.array_equal(
          np.array(out1.as_tensor()), np.full((2, 10, 1), 0)
      )
      assert np.array_equal(
          np.array(out2.as_tensor()), np.full((2, 10, 1), 1)
      )
      assert np.array_equal(
          np.array(out3.as_tensor()), np.full((2,), 10)
      )
  
imports: from pathlib import Path
  import numpy
  from typing import cast, Sequence, Union
  from nvidia.dali import fn, ops
  from nvidia.dali import types, tensors
  from nvidia.dali.data_node import DataNode
  from nvidia.dali.pipeline import pipeline_def, Pipeline
  from test_utils import get_dali_extra_path, check_numba_compatibility_cpu
  from nose.plugins.attrib import attr
label_desc: Use image node_id 10 for calling a global function with example usage: test_python_function_pipe() and returns: unknown,  zeros_2,  ones,  ten_from_constant