code: def __init__(
      self,
      net: nn.Module,
      device: torch.device,
      *,
      with_flip: bool = False,
      mean: Tuple[float, float, float] = (0.485, 0.456, 0.406),
      std: Tuple[float, float, float] = (0.229, 0.224, 0.225),
  ):
      self.device = device
      self.net = net.to(self.device)
      self.net.eval()
  
      if hasattr(net, "depth"):
          size_divisor = 2 ** (net.depth + 1)
      elif isinstance(net, HRNetIHModel):
          size_divisor = 128
      else:
          size_divisor = 1
  
      mean = torch.tensor(mean, dtype=torch.float32)
      std = torch.tensor(std, dtype=torch.float32)
      self.transforms = [
          PadToDivisor(divisor=size_divisor, border_mode=0),
          ToTensor("cpu"),
          NormalizeTensor(mean, std, "cpu"),
      ]
      if with_flip:
          self.transforms.append(AddFlippedTensor())
  
file_path: carefree-learn/cflearn/api/cv/third_party/iharm/inference/predictor.py
imports: import torch
  import numpy
  from torch import nn
  from typing import Tuple
  from .transforms import ToTensor
  from .transforms import PadToDivisor
  from .transforms import NormalizeTensor
  from .transforms import AddFlippedTensor
  from ..model.backboned import HRNetIHModel
label_desc: Use image node_id 1 to create a new Predictor object  with example: obj = Predictor(net, device)