code: def test_io_tensor_slice_in_dataset(
      fixture_lookup, io_tensor_fixture, num_parallel_calls
  ):
      """test_io_tensor_slice_in_dataset"""
      args, func, expected, equal = fixture_lookup(io_tensor_fixture)
  
      # Test to_tensor within dataset
  
      # Note: @tf.function is actually not needed, as tf.data.Dataset
      # will automatically wrap the `func` into a graph anyway.
      # The following is purely for explanation purposes.
      @tf.function
      def f(e):
          return func(e).to_tensor()
  
      dataset = tf.data.Dataset.from_tensor_slices([args, args])
      dataset = dataset.map(f, num_parallel_calls=num_parallel_calls)
  
      item = 0
      for entries in dataset:
          assert len(entries) == len(expected)
          assert equal(entries, expected)
          item += 1
      assert item == 2
  
      # Note: @tf.function is actually not needed, as tf.data.Dataset
      # will automatically wrap the `func` into a graph anyway.
      # The following is purely for explanation purposes.
      @tf.function
      def g(e):
          return func(e)[0:100]
  
      dataset = tf.data.Dataset.from_tensor_slices([args, args])
      dataset = dataset.map(g, num_parallel_calls=num_parallel_calls)
  
      item = 0
      for entries in dataset:
          assert len(entries) == len(expected[:100])
          assert equal(entries, expected[:100])
          item += 1
      assert item == 2
  
imports: import os
  import shutil
  import tempfile
  import numpy
  import pytest
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 23 for calling a global function with example usage: test_io_tensor_slice_in_dataset(fixture_lookup, io_tensor_fixture, num_parallel_calls) and returns: func, func