class_docstr: Data loader for the Kodak image data set.
  
  Args:
      root: base directory for data set.
      check_hash: if ``True``, checks the sha1 hash of root at
          initialization time to make sure files were downloaded correctly.
      download: if ``True``, downloads the dataset from the
          internet and puts it in root directory.
      force_download: if ``True`` and ``download=True``, will download
          the dataset even if the root directory already exists.
          If ``False``, an error will be thrown if ``download=True``
          but the root directory already exists.
      kodak_url: URL for downloading public images.
          Defaults to http://r0k.us/graphics/kodak/kodak/.
      transform: callable object for transforming the
          loaded images.
class_docstr_tok: ["Data","loader","for","the","Kodak","image","data","set",".","Args",":","root",":","base","directory","for","data","set",".","check_hash",":","if","``","True","``",",","checks","the","sha1","hash","of","root","at","initialization","time","to","make","sure","files","were","downloaded","correctly",".","download",":","if","``","True","``",",","downloads","the","dataset","from","the","internet","and","puts","it","in","root","directory",".","force_download",":","if","``","True","``","and","``","download=True","``",",","will","download","the","dataset","even","if","the","root","directory","already","exists",".","If","``","False","``",",","an","error","will","be","thrown","if","``","download=True","``","but","the","root","directory","already","exists",".","kodak_url",":","URL","for","downloading","public","images",".","Defaults","to","http",":","\/\/r0k.us\/graphics\/kodak\/kodak\/",".","transform",":","callable","object","for","transforming","the","loaded","images","."]
code: def _download(self, kodak_url, num_imgs, force=False):
      if self.root.exists() and not force:
          raise RuntimeError(
              "Dataset directory already exists - to proceed"
              " with dataset download anyways pass force_download=True"
          )
  
      self.root.mkdir()
  
      for im_num in tqdm(
          range(1, num_imgs + 1), desc="Downloading Kodak images"
      ):
          img_name = "kodim{:02}.png".format(im_num)
          local_file = self.root / img_name
          url = kodak_url + img_name
          with urllib.request.urlopen(url) as response, open(
              local_file, "wb"
          ) as out_file:
              shutil.copyfileobj(response, out_file)
  
file_path: NeuralCompression/neuralcompression/data/_kodak.py
imports: import hashlib
  import shutil
  import urllib
  import urllib.request
  from pathlib import Path
  from typing import Any, Callable, Optional, Union
  from torch import Tensor
  from torch.utils.data import Dataset
  from torchvision.datasets.folder import default_loader
  from tqdm import tqdm
label_desc: Use image node_id 3 for calling the Kodak obj's underlying member method code with example usage: obj._download(kodak_url, num_imgs, force) without return types