class_docstr: Generic container to quickly build `Datasets` and `DataLoaders`.
class_docstr_tok: ["Generic","container","to","quickly","build","`","Datasets","`","and","`","DataLoaders","`","."]
code: def __init__(
      self,
      blocks: list = None,  # One or more `TransformBlock`s
      dl_type: TfmdDL = None,  # Task specific `TfmdDL`, defaults to `block`'s dl_type or`TfmdDL`
      getters: list = None,  # Getter functions applied to results of `get_items`
      n_inp: int = None,  # Number of inputs
      item_tfms: list = None,  # `ItemTransform`s, applied on an item
      batch_tfms: list = None,  # `Transform`s or `RandTransform`s, applied by batch
      **kwargs,
  ):
      blocks = L(self.blocks if blocks is None else blocks)
      blocks = L(b() if callable(b) else b for b in blocks)
      self.type_tfms = blocks.attrgot("type_tfms", L())
      self.default_item_tfms = _merge_tfms(
          *blocks.attrgot("item_tfms", L())
      )
      self.default_batch_tfms = _merge_tfms(
          *blocks.attrgot("batch_tfms", L())
      )
      for b in blocks:
          if getattr(b, "dl_type", None) is not None:
              self.dl_type = b.dl_type
      if dl_type is not None:
          self.dl_type = dl_type
      self.dataloaders = delegates(self.dl_type.__init__)(
          self.dataloaders
      )
      self.dls_kwargs = merge(*blocks.attrgot("dls_kwargs", {}))
  
      self.n_inp = ifnone(n_inp, max(1, len(blocks) - 1))
      self.getters = ifnone(getters, [noop] * len(self.type_tfms))
      if self.get_x:
          if len(L(self.get_x)) != self.n_inp:
              raise ValueError(
                  f"get_x contains {len(L(self.get_x))} functions, but must contain {self.n_inp} (one for each input)\n{self._msg}"
              )
          self.getters[: self.n_inp] = L(self.get_x)
      if self.get_y:
          n_targs = len(self.getters) - self.n_inp
          if len(L(self.get_y)) != n_targs:
              raise ValueError(
                  f"get_y contains {len(L(self.get_y))} functions, but must contain {n_targs} (one for each target)\n{self._msg}"
              )
          self.getters[self.n_inp :] = L(self.get_y)
  
      if kwargs:
          raise TypeError(
              f'invalid keyword arguments: {", ".join(kwargs.keys())}'
          )
      self.new(item_tfms, batch_tfms)
  
imports: from __future__ import annotations
  from ..torch_basics import *
  from .core import *
  from .load import *
  from .external import *
  from .transforms import *
  from inspect import isfunction, ismethod
  from .load import _collate_types
label_desc: Use image node_id 1 to create a new DataBlock object  with example: obj = DataBlock(blocks, dl_type, getters, n_inp, item_tfms, batch_tfms)