docstr: Create a directory for training and test and extract all the images and labels to this destination.
  
  :args:
      dataset (str) : the label for the dataset
      path (str): the raw dataset path
  :returns:
      A tuple of the label for the image, the file array, the size and rows and columns for the image
docstr_tok: ["Create","a","directory","for","training","and","test","and","extract","all","the","images","and","labels","to","this","destination",".",":","args",":","dataset","(","str",")",":","the","label","for","the","dataset","path","(","str",")",":","the","raw","dataset","path",":","returns",":","A","tuple","of","the","label","for","the","image",",","the","file","array",",","the","size","and","rows","and","columns","for","the","image"]
code: def read_source_dataset(self, dataset="training", path="."):
      """Create a directory for training and test and extract all the images and labels to this destination.
  
      :args:
          dataset (str) : the label for the dataset
          path (str): the raw dataset path
      :returns:
          A tuple of the label for the image, the file array, the size and rows and columns for the image
      """
      if dataset == "training":
          fname_img = os.path.join(path, "train-images-idx3-ubyte")
          fname_lbl = os.path.join(path, "train-labels-idx1-ubyte")
      elif dataset == "testing":
          fname_img = os.path.join(path, "t10k-images-idx3-ubyte")
          fname_lbl = os.path.join(path, "t10k-labels-idx1-ubyte")
      else:
          raise ValueError("dataset must be 'testing' or 'training'")
  
      with open(fname_lbl, "rb") as flbl:
          struct.unpack(">II", flbl.read(8))
          lbl = np.frombuffer(flbl.read(), dtype=np.uint8)
  
      with open(fname_img, "rb") as fimg:
          magic_nr, size, rows, cols = struct.unpack(
              ">IIII", fimg.read(16)
          )
          img = np.frombuffer(fimg.read(), dtype=np.uint8)
          img = img.reshape((size, rows, cols))
  
      return lbl, img
  
file_path: ludwig/ludwig/datasets/loaders/mnist.py
imports: import logging
  import os
  import struct
  from multiprocessing.pool import ThreadPool
  from typing import List, Optional
  import numpy
  import pandas
  import torch
  from ludwig.datasets.dataset_config import DatasetConfig
  from ludwig.datasets.loaders.dataset_loader import DatasetLoader
  from ludwig.utils.fs_utils import makedirs
label_desc: Use image node_id 4 for calling the MNISTLoader obj's underlying member method code with example usage: obj.read_source_dataset(dataset, path) and returns: lbl,  img