class_docstr: Class implementing Scaler operators in PyTorch. Supported normalizers are L1, L2 and Max.
code: def __init__(self, logical_operator, offset, scale, device):
      super(Scaler, self).__init__(logical_operator, transformer=True)
  
      if (
          offset is None
          or len(offset.shape) == 0
          or offset.shape == (0,)
      ):
          offset = numpy.array([0], dtype=numpy.float32)
      if scale is None or len(scale.shape) == 0 or scale.shape == (0,):
          scale = numpy.array([1], dtype=numpy.float32)
  
      self.offset = offset
      self.scale = scale
  
      if offset is not None:
          self.offset = torch.nn.Parameter(
              torch.from_numpy(offset).detach().clone(),
              requires_grad=False,
          )
  
      if scale is not None:
          self.scale = torch.nn.Parameter(
              torch.from_numpy(scale).detach().clone(),
              requires_grad=False,
          )
  
file_path: hummingbird/hummingbird/ml/operator_converters/_scaler_implementations.py
imports: import numpy
  import torch
  from ._physical_operator import PhysicalOperator
label_desc: Use image node_id 1 to create a new Scaler object from inherited base classes: PhysicalOperator, torch.nn with example: obj = Scaler(logical_operator, offset, scale, device)