code: def check_slice_output(
      sample_in,
      sample_out,
      anchor,
      abs_slice_shape,
      abs_start,
      abs_end,
      out_of_bounds_policy,
      fill_values,
      naxes=2,
      mean=None,
      std=None,
      flip=None,
      permute=None,
  ):
      in_shape = sample_in.shape
      out_shape = sample_out.shape
      ndim = len(out_shape)
      orig_nchannels = in_shape[2]
      out_ch_dim = permute.index(2) if permute is not None else 2
      out_nchannels = out_shape[out_ch_dim]
  
      if out_of_bounds_policy == "pad":
          if permute is not None:
              assert all(
                  [
                      abs_slice_shape[permute[i]] == out_shape[i]
                      for i in range(ndim)
                      if permute[i] < naxes
                  ]
              )
          else:
              assert all(
                  [
                      abs_slice_shape[i] == out_shape[i]
                      for i in range(naxes)
                  ]
              )
      elif out_of_bounds_policy == "trim_to_shape":
          assert all(
              [out_shape[i] <= in_shape[i] for i in range(naxes)]
          )
          for i in range(naxes):
              if abs_start[i] < 0:
                  abs_start[i] = 0
              if abs_end[i] > in_shape[i]:
                  abs_end[i] = in_shape[i]
              abs_slice_shape[i] = abs_end[i] - abs_start[i]
          if permute is not None:
              assert all(
                  [
                      abs_slice_shape[permute[i]] == out_shape[i]
                      for i in range(ndim)
                      if permute[i] < naxes
                  ]
              )
          else:
              assert all(
                  [
                      abs_slice_shape[i] == out_shape[i]
                      for i in range(naxes)
                  ]
              )
      else:
          raise ValueError(
              f"Wrong out_of_bounds_policy: {out_of_bounds_policy}"
          )
  
      pad_before = [
          -abs_start[i] if abs_start[i] < 0 else 0 for i in range(naxes)
      ]
      pad_after = [
          abs_end[i] - in_shape[i] if in_shape[i] < abs_end[i] else 0
          for i in range(naxes)
      ]
      sliced = [
          abs_slice_shape[i] - pad_before[i] - pad_after[i]
          for i in range(naxes)
      ]
  
      if out_of_bounds_policy == "trim_to_shape":
          assert all([pad_before[i] == 0 for i in range(naxes)])
          assert all([pad_after[i] == 0 for i in range(naxes)])
  
          if permute is not None:
              assert all(
                  [
                      sliced[permute[i]] == out_shape[i]
                      for i in range(ndim)
                      if permute[i] < naxes
                  ]
              )
          else:
              assert all(
                  [sliced[i] == out_shape[i] for i in range(naxes)]
              )
  
      pos_start = [
          abs_start[i] if abs_start[i] >= 0 else 0 for i in range(naxes)
      ]
  
      in_sliced = sample_in[
          pos_start[0] : pos_start[0] + sliced[0],  # noqa:E203
          pos_start[1] : pos_start[1] + sliced[1],
          :,
      ]  # noqa:E203
  
      slice_shape = (
          abs_slice_shape[0],
          abs_slice_shape[1],
          out_nchannels,
      )
      expected = np.zeros(slice_shape, dtype=np.float32)
      expected[:, :, :orig_nchannels] = np.full(
          (slice_shape[0], slice_shape[1], orig_nchannels), fill_values
      )
      should_normalize = mean is not None and std is not None
  
      expected[
          pad_before[0] : pad_before[0] + sliced[0],  # noqa:E203
          pad_before[1] : pad_before[1] + sliced[1],  # noqa:E203
          :orig_nchannels,
      ] = (
          (in_sliced - mean) / std if should_normalize else in_sliced
      )
  
      if flip is not None:
          for d in range(len(flip)):
              if flip[d]:
                  expected = np.flip(expected, d)
  
      if permute is not None:
          expected = np.transpose(expected, permute)
  
      np.testing.assert_allclose(sample_out, expected, atol=1e-07)
  
imports: from nvidia.dali import Pipeline, pipeline_def, ops, fn, types
  import numpy
  import os
  from functools import partial
  from math import floor
  from test_utils import compare_pipelines, get_dali_extra_path, RandomDataIterator, generator_random_axes_for_3d_input, generator_random_data, as_array
  from nose_utils import assert_raises
  from nose2.tools import params
label_desc: Use image node_id 10 for calling a global function with example usage: check_slice_output(sample_in, sample_out, anchor, abs_slice_shape, abs_start, abs_end, out_of_bounds_policy, fill_values, naxes, mean, std, flip, permute) without return types