code: def test_element_spec_shape_with_tensors(self):
      ds = ray.data.from_items(
          8 * [{"spam": np.zeros([3, 32, 32]), "ham": 0}]
      )
  
      dataset = ds.to_tf(
          feature_columns="spam", label_columns="ham", batch_size=4
      )
  
      feature_spec, _ = dataset.element_spec
      assert tuple(feature_spec.shape) == (None, 3, 32, 32)
  
      features, labels = next(iter(dataset))
      assert tuple(features.shape) == (4, 3, 32, 32)
      assert tuple(labels.shape) == (4,)
  
file_path: ray/python/ray/data/tests/test_tf.py
imports: import numpy
  import pandas
  import pytest
  import tensorflow
  import ray
  from ray import train
  from ray.data.preprocessors import Concatenator
  from ray.train import ScalingConfig
  from ray.train.tensorflow import TensorflowTrainer
label_desc: Use image node_id 7 for calling the TestToTF obj's underlying member method code with example usage: obj.test_element_spec_shape_with_tensors() without return types