class_docstr: Converts a ``PIL Image`` to a ``torch.LongTensor``.
  Code adapted from: http://pytorch.org/docs/master/torchvision/transforms.html?highlight=totensor
class_docstr_tok: ["Converts","a","``","PIL","Image","``","to","a","``","torch.LongTensor","``",".","Code","adapted","from",":","http",":","\/\/pytorch.org\/docs\/master\/torchvision\/transforms.html","?","highlight=totensor"]
docstr: Performs the conversion from a ``PIL Image`` to a ``torch.LongTensor``.
  Keyword arguments:
  - pic (``PIL.Image``): the image to convert to ``torch.LongTensor``
  Returns:
  A ``torch.LongTensor``.
docstr_tok: ["Performs","the","conversion","from","a","``","PIL","Image","``","to","a","``","torch.LongTensor","``",".","Keyword","arguments",":","-","pic","(","``","PIL.Image","``",")",":","the","image","to","convert","to","``","torch.LongTensor","``","Returns",":","A","``","torch.LongTensor","``","."]
code: def __call__(self, pic):
      """Performs the conversion from a ``PIL Image`` to a ``torch.LongTensor``.
      Keyword arguments:
      - pic (``PIL.Image``): the image to convert to ``torch.LongTensor``
      Returns:
      A ``torch.LongTensor``.
      """
      if isinstance(pic, Image.Image):
          pic = np.array(pic.convert("RGB"))
  
      if self.clss is not None:
          img = torch.from_numpy(self.encode_segmap(pic))
      else:
          img = torch.from_numpy(pic.transpose((2, 0, 1)))
      # backward compatibility
      return img.long()
  
file_path: baal/baal/utils/transforms.py
imports: import numpy
  import torch
  from PIL import Image
label_desc: Use image node_id 2 for calling the PILToLongTensor obj's underlying member method code with example usage: obj.__call__(pic) and returns: img