class_docstr: A Dataset feature encodes a nested dataset.
  
  `Dataset` corresponds to a dataset of `tfds.features.FeatureConnector`. Using
  `tfds.features.Dataset` will return a nested `tf.data.Dataset` inside the
  top-level `tf.data.Dataset` returned by `tfds.load`. At generation time, an
  iterable over the dataset elements is given.
  
  If you use tfds.data_source and the NumPy path, `Dataset` will return
  a [data
  source](https://www.tensorflow.org/datasets/api_docs/python/tfds/data_source).
  The advantage of having a data source is that decoding will be lazily executed
  when you access each example in the dataset.
  
  This is an experimental feature. Currently, only one level of nesting is
  supported and TF1 graph is not supported either.
  
  Example:
  At construction time (inside `_info`):
  
  ```python
    features=tfds.features.FeatureDict({
     'agent_id': np.object_,
      'episode': tfds.features.Dataset({
        'observation': tfds.features.Image(),
        'reward': tfds.features.Image(),
      }),
    })
  ```
  
  
  Will return:
  
  ```
  {
    'agent_id': tf.Tensor(shape=(), dtype=tf.string),
    'episode': tf.data.Dataset(element_spec={
        'observation': tf.Tensor(shape=(None, None, 3), dtype=tf.uint8),
        'reward': tf.Tensor(shape=(), dtype=tf.int32),
    }),
    }
  ```
  
  The nested dataset can be used as:
  
  ```
  for e in tfds.load(...): # {'agent_id': tf.Tensor, 'episode': tf.data.Dataset}
    for step in e['episode']:  # Each episode is a nested  `tf.data.Dataset`
      step['observation']
  ```
  
  During generation,  it accept any `Iterable`/`Iterator`, like
  
  ```python
  yield _, {
    'agent_id': agent_name
    'episode': ({'observation': ..., 'reward': ...} for _ in range(10)),
  }
  ```
  
  Or a dictionary of `Iterable`, like
  
  ```python
  yield _, {
    'agent_id': agent_name
    'episode': {'observation': np.ones(10), 'reward': np.ones(10)} ,
  }
  ```
class_docstr_tok: ["A","Dataset","feature","encodes","a","nested","dataset",".","`","Dataset","`","corresponds","to","a","dataset","of","`","tfds.features.FeatureConnector","`",".","Using","`","tfds.features.Dataset","`","will","return","a","nested","`","tf.data.Dataset","`","inside","the","top-level","`","tf.data.Dataset","`","returned","by","`","tfds.load","`",".","At","generation","time",",","an","iterable","over","the","dataset","elements","is","given",".","If","you","use","tfds.data_source","and","the","NumPy","path",",","`","Dataset","`","will","return","a","[","data","source","]","(","https",":","\/\/www.tensorflow.org\/datasets\/api_docs\/python\/tfds\/data_source",")",".","The","advantage","of","having","a","data","source","is","that","decoding","will","be","lazily","executed","when","you","access","each","example","in","the","dataset",".","This","is","an","experimental","feature",".","Currently",",","only","one","level","of","nesting","is","supported","and","TF1","graph","is","not","supported","either",".","Example",":","At","construction","time","(","inside","`","_info","`",")",":","``","`","python","features=tfds.features.FeatureDict","(","{","'agent_id","'",":","np.object_",",","'episode","'",":","tfds.features.Dataset","(","{","'observation","'",":","tfds.features.Image","(",")",",","'reward","'",":","tfds.features.Image","(",")",",","}",")",",","}",")","``","`","Will","return",":","``","`","{","'agent_id","'",":","tf.Tensor","(","shape=","(",")",",","dtype=tf.string",")",",","'episode","'",":","tf.data.Dataset","(","element_spec=","{","'observation","'",":","tf.Tensor","(","shape=","(","None",",","None",",","3",")",",","dtype=tf.uint8",")",",","'reward","'",":","tf.Tensor","(","shape=","(",")",",","dtype=tf.int32",")",",","}",")",",","}","``","`","The","nested","dataset","can","be","used","as",":","``","`","for","e","in","tfds.load","(","...",")",":","#","{","'agent_id","'",":","tf.Tensor",",","'episode","'",":","tf.data.Dataset","}","for","step","in","e","[","'episode","'","]",":","#","Each","episode","is","a","nested","`","tf.data.Dataset","`","step","[","'observation","'","]","``","`","During","generation",",","it","accept","any","`","Iterable","`","\/","`","Iterator","`",",","like","``","`","python","yield","_",",","{","'agent_id","'",":","agent_name","'episode","'",":","(","{","'observation","'",":","...",",","'reward","'",":","...","}","for","_","in","range","(","10",")",")",",","}","``","`","Or","a","dictionary","of","`","Iterable","`",",","like","``","`","python","yield","_",",","{","'agent_id","'",":","agent_name","'episode","'",":","{","'observation","'",":","np.ones","(","10",")",",","'reward","'",":","np.ones","(","10",")","}",",","}","``","`"]
code: def get_serialized_info(self):
      # Add the dataset level and the number of elements in the dataset
      tensor_info = super().get_serialized_info()
      return tree_utils.map_structure(_add_dataset_lvl, tensor_info)
  
imports: from __future__ import annotations
  import dataclasses
  import functools
  from typing import Any, Callable, Dict, Iterator, Union
  from tensorflow_datasets.core.data_sources import python
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.features import sequence_feature
  from tensorflow_datasets.core.features import tensor_feature
  from tensorflow_datasets.core.features import top_level_feature
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import tree_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 3 for calling the Dataset obj's underlying member method code with example usage: obj.get_serialized_info() and returns: tree_utils