class_docstr: Utilities to manage information pertaining to quantization of tensors in a PyTorch graph.
docstr: Quantizes the provided named var as per quantization params.
  zero_point will be cast to the appropriate dtype based on torch_dtype.
docstr_tok: ["Quantizes","the","provided","named","var","as","per","quantization","params",".","zero_point","will","be","cast","to","the","appropriate","dtype","based","on","torch_dtype","."]
code: def get_quantized_per_tensor(
      self, name, torch_dtype, scale, zero_point, quantized_name
  ):
      """
      Quantizes the provided named var as per quantization params.
      zero_point will be cast to the appropriate dtype based on torch_dtype.
      """
      if self._quant_dtype is None:
          self._quant_dtype = torch_dtype
      elif self._quant_dtype != torch_dtype:
          raise NotImplementedError(
              "Currently we only support a single activation dtype throughout the model"
          )
  
      if torch_dtype == torch.quint8:
          zero_point = np.uint8(zero_point)
          output_dtype = "uint8"
      elif torch_dtype == torch.qint8:
          zero_point = np.int8(zero_point)
          output_dtype = "int8"
      else:
          raise ValueError(
              f"Invalid torch dtype for quantization: {torch_dtype}"
          )
      if np.isscalar(zero_point):
          # MIL allows skipping zero_point if its zero.
          if zero_point == 0:
              zero_point = None
          # TODO (rdar://107718371): skip 128 for uint8 by switching to int8
  
      result = mb.quantize(
          input=self._context[name],
          zero_point=zero_point,
          scale=scale,
          output_dtype=output_dtype,
      )
      self._context.add(result, quantized_name)
      self._context.quant_context.add_quantization_info(
          quantized_name, torch_dtype, scale, zero_point
      )
      return result
  
imports: from collections import OrderedDict
  from typing import List, Optional, Union
  import numpy
  import torch
  from torch.jit._script import RecursiveScriptModule
  from coremltools import _logger
  from coremltools._deps import _HAS_TORCH_EXPORT_API
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.input_types import ImageType, InputType, TensorType
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Function, Placeholder, Program, types
  from coremltools.converters.mil.mil.types import is_float
  from coremltools.converters.mil.mil.var import Var
  from .._utils import get_output_names
  from .internal_graph import InternalTorchIRGraph, InternalTorchIRNode
  from .ops import TorchFrontend, convert_nodes
  from .quantization_ops import _dequantized_weight
  from .torch_op_registry import _TORCH_OPS_REGISTRY
  from .torchir_passes import flatten_graph_input_values, flatten_graph_output_values, generate_tensor_assignment_ops, remove_getattr_nodes, transform_inplace_ops
  from .torchscript_utils import torch_to_mil_types
label_desc: Use image node_id 5 for calling the QuantizationContext obj's underlying member method code with example usage: obj.get_quantized_per_tensor(name, torch_dtype, scale, zero_point, quantized_name) and returns: result