code: def linear_quantize(input, scale, zero_point, inplace=False):
      """
      Quantize single-precision input tensor to integers with the given scaling factor and zeropoint.
  
      Args:
          input (`torch.Tensor`):
              Single-precision input tensor to be quantized.
          scale (`torch.Tensor`):
              Scaling factor for quantization.
          zero_pint (`torch.Tensor`):
              Shift for quantization.
          inplace (`bool`, *optional*, defaults to `False`):
              Whether to compute inplace or not.
  
      Returns:
          `torch.Tensor`: Linearly quantized value of *input* according to *scale* and *zero_point*.
      """
      # reshape scale and zeropoint for convolutional weights and activation
      if len(input.shape) == 4:
          scale = scale.view(-1, 1, 1, 1)
          zero_point = zero_point.view(-1, 1, 1, 1)
      # reshape scale and zeropoint for linear weights
      elif len(input.shape) == 2:
          scale = scale.view(-1, 1)
          zero_point = zero_point.view(-1, 1)
      else:
          scale = scale.view(-1)
          zero_point = zero_point.view(-1)
      # quantized = float / scale + zero_point
      if inplace:
          input.mul_(1.0 / scale).add_(zero_point).round_()
          return input
      return torch.round(1.0 / scale * input + zero_point)
  
imports: import decimal
  import numpy
  import torch
  from torch import nn
  from torch.autograd import Function
  from ...utils import logging
label_desc: Use image node_id 2 for calling a global function with example usage: linear_quantize(input, scale, zero_point, inplace) and returns: torch, input