class_docstr: Apply a fixed permutation to the pixels of the given image.
  
  Works with both Tensors and PIL images. Returns an object of the same type
  of the input element.
code: def __call__(self, img: Union[Image, Tensor]):
      is_image = isinstance(img, Image)
      if (not is_image) and (not isinstance(img, Tensor)):
          raise ValueError(
              "Invalid input: must be a PIL image or a Tensor"
          )
  
      image_as_tensor: Tensor
      if is_image:
          image_as_tensor = self._to_tensor(img)
      else:
          image_as_tensor = img
  
      image_as_tensor = image_as_tensor.view(-1)[self.permutation].view(
          *image_as_tensor.shape
      )
  
      if is_image:
          img = self._to_image(image_as_tensor)
      else:
          img = image_as_tensor
  
      return img
  
file_path: avalanche/avalanche/benchmarks/classic/comniglot.py
imports: from pathlib import Path
  from typing import Optional, Sequence, Any, Union
  from torch import Tensor
  from torchvision.transforms import ToTensor, Compose, Normalize, ToPILImage
  from PIL.Image import Image
  from avalanche.benchmarks import nc_benchmark
  from avalanche.benchmarks.classic.classic_benchmarks_utils import check_vision_benchmark
  from avalanche.benchmarks.datasets import default_dataset_location
  from avalanche.benchmarks.datasets.omniglot import Omniglot
label_desc: Use image node_id 2 for calling the PixelsPermutation obj's underlying member method code with example usage: obj.__call__(img) and returns: img