class_docstr: CIFAR-10 dataset.
class_docstr_tok: ["CIFAR-10","dataset","."]
docstr: Prepares the image for network input.
docstr_tok: ["Prepares","the","image","for","network","input","."]
code: def _prepare_im(self, im):
      """Prepares the image for network input."""
      for i in range(3):
          # Perform per-channel normalization on CHW image
          im[i] = (im[i] - _MEAN[i]) / _STD[i]
      if self._split == "train":
          # Randomly flip and crop center patch from CHW image
          size = cfg.TRAIN.IM_SIZE
          im = im[:, :, ::-1] if np.random.uniform() < 0.5 else im
          im = np.pad(im, ((0, 0), (4, 4), (4, 4)), mode="constant")
          y = np.random.randint(0, im.shape[1] - size)
          x = np.random.randint(0, im.shape[2] - size)
          im = im[:, y : (y + size), x : (x + size)]
      return im
  
file_path: pycls/pycls/datasets/cifar10.py
imports: import os
  import pickle
  import numpy
  import pycls.core.logging
  import torch.utils.data
  from pycls.core.config import cfg
  from pycls.core.io import pathmgr
label_desc: Use image node_id 3 for calling the Cifar10 obj's underlying member method code with example usage: obj._prepare_im(im) and returns: im