code: def __init__(
      self, input_dataset: "Dataset", map_func: Callable
  ) -> None:
      create_pre_dataset_fn = input_dataset.create_dataset_fn
      xshards_pre_transform_fn = input_dataset.xshards_transform_fn
  
      def create_dataset_fn(data):
          dataset = create_pre_dataset_fn(data)
          return dataset.map(map_func)
  
      def xshards_transform_fn(data):
          if xshards_pre_transform_fn is None:
              return data.transform_shard(map_func)
          else:
              pre_shards = xshards_pre_transform_fn(data)
              return pre_shards.transform_shard(map_func)
  
      super().__init__(
          xshards=input_dataset.xshards,
          create_dataset_fn=create_dataset_fn,
          xshards_transform_fn=xshards_transform_fn,
      )
  
imports: import tensorflow
  from bigdl.orca.tfpark.tf_dataset import TensorMeta
  from bigdl.dllib.utils import nest
  from bigdl.orca.data import SparkXShards
  from bigdl.dllib.utils import log4Error
  from bigdl.dllib.utils.log4Error import invalidInputError
  from typing import TYPE_CHECKING, Callable, Optional, Any
label_desc: Use image node_id 1 to create a new MapDataset object from inherited base classes: Dataset with example: obj = MapDataset(input_dataset, map_func)