code: def test_basic_flow(self, use_sample_weight):
      x = np.random.random((64, 4))
      y = np.array([[i, i] for i in range(64)], dtype="float64")
      if use_sample_weight:
          sw = np.random.random((64,))
      else:
          sw = None
      make_generator = example_generator(
          x,
          y,
          sample_weight=sw,
          batch_size=16,
      )
      adapter = generator_data_adapter.GeneratorDataAdapter(
          make_generator()
      )
  
      gen = adapter.get_numpy_iterator()
      sample_order = []
      for batch in gen:
          if use_sample_weight:
              self.assertEqual(len(batch), 3)
              bx, by, bsw = batch
          else:
              self.assertEqual(len(batch), 2)
              bx, by = batch
  
          self.assertIsInstance(bx, np.ndarray)
          self.assertIsInstance(by, np.ndarray)
          self.assertEqual(bx.dtype, by.dtype)
          self.assertEqual(bx.shape, (16, 4))
          self.assertEqual(by.shape, (16, 2))
          if use_sample_weight:
              self.assertIsInstance(bsw, np.ndarray)
          for i in range(by.shape[0]):
              sample_order.append(by[i, 0])
      self.assertAllClose(sample_order, list(range(64)))
  
      adapter = generator_data_adapter.GeneratorDataAdapter(
          make_generator(),
      )
      ds = adapter.get_tf_dataset()
      sample_order = []
      for batch in ds:
          if use_sample_weight:
              self.assertEqual(len(batch), 3)
              bx, by, bsw = batch
          else:
              self.assertEqual(len(batch), 2)
              bx, by = batch
          self.assertIsInstance(bx, tf.Tensor)
          self.assertIsInstance(by, tf.Tensor)
          self.assertEqual(bx.dtype, by.dtype)
          self.assertEqual(tuple(bx.shape), (16, 4))
          self.assertEqual(tuple(by.shape), (16, 2))
          if use_sample_weight:
              self.assertIsInstance(bsw, tf.Tensor)
          for i in range(by.shape[0]):
              sample_order.append(by[i, 0])
      self.assertAllClose(sample_order, list(range(64)))
  
file_path: keras/keras/trainers/data_adapters/generator_data_adapter_test.py
imports: import math
  import numpy
  import scipy
  import tensorflow
  from absl.testing import parameterized
  from keras import testing
  from keras.trainers.data_adapters import generator_data_adapter
label_desc: Use image node_id 1 for calling the GeneratorDataAdapterTest obj's underlying member method code with example usage: obj.test_basic_flow(use_sample_weight) without return types