class_docstr: `LSUN <https://www.yf.io/p/lsun>`_ dataset.
  
  You will need to install the ``lmdb`` package to use this dataset: run
  ``pip install lmdb``
  
  Args:
      root (string): Root directory for the database files.
      classes (string or list): One of {'train', 'val', 'test'} or a list of
          categories to load. e,g. ['bedroom_train', 'church_outdoor_train'].
      transform (callable, optional): A function/transform that takes in a PIL image
          and returns a transformed version. E.g, ``transforms.RandomCrop``
      target_transform (callable, optional): A function/transform that takes in the
          target and transforms it.
class_docstr_tok: ["`","LSUN","<","https",":","\/\/www.yf.io\/p\/lsun",">","`","_","dataset",".","You","will","need","to","install","the","``","lmdb","``","package","to","use","this","dataset",":","run","``","pip","install","lmdb","``","Args",":","root","(","string",")",":","Root","directory","for","the","database","files",".","classes","(","string","or","list",")",":","One","of","{","'train","'",",","'val","'",",","'test","'","}","or","a","list","of","categories","to","load",".","e",",","g",".","[","'bedroom_train","'",",","'church_outdoor_train","'","]",".","transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","a","PIL","image","and","returns","a","transformed","version",".","E.g",",","``","transforms.RandomCrop","``","target_transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","the","target","and","transforms","it","."]
code: def __init__(
      self,
      root: str,
      classes: Union[str, List[str]] = "train",
      transform: Optional[Callable] = None,
      target_transform: Optional[Callable] = None,
  ) -> None:
      super().__init__(
          root, transform=transform, target_transform=target_transform
      )
      self.classes = self._verify_classes(classes)
  
      # for each class, create an LSUNClassDataset
      self.dbs = []
      for c in self.classes:
          self.dbs.append(
              LSUNClass(
                  root=os.path.join(root, f"{c}_lmdb"),
                  transform=transform,
              )
          )
  
      self.indices = []
      count = 0
      for db in self.dbs:
          count += len(db)
          self.indices.append(count)
  
      self.length = count
  
imports: import io
  import os.path
  import pickle
  import string
  from collections.abc import Iterable
  from typing import Any, Callable, cast, List, Optional, Tuple, Union
  from PIL import Image
  from .utils import iterable_to_str, verify_str_arg
  from .vision import VisionDataset
label_desc: Use image node_id 1 to create a new LSUN object from inherited base classes: VisionDataset with example: obj = LSUN(root, classes, transform, target_transform)