code: def pack_biases(
      biases: np.ndarray,
      ifm_scale: float,
      ifm_dtype: np.dtype,
      weight_scales: np.ndarray,
      ofm_scale: float,
      is_activation_tanh_or_sigmoid: bool = False,
  ) -> np.ndarray:
      """
      The NPU requires the each bias value to be packed with
      output scale parameters in a 80-bit format (that is returned
      via npu_encode_bias API). This function will pack such values
      to a binary artifact that the NPU will use in the execution.
  
  
      Parameters
      ----------
      biases : numpy.ndarray
          The values of biases
      ifm_scale : float
          The quantization scale parameter of input feature map
      ifm_dtype : numpy.dtype
          The data type of input feature map data.
      weight_scales : numpy.ndarray
          The quantization scale parameter of weight feature map
          This could be a tuple if per-channel quantization is present.
      ofm_scale : float
          The quantization scale parameter of output feature map.
      is_activation_tanh_or_sigmoid : bool
          Indicates whether the fused activation function is tanh or sigmoid.
  
      Returns
      -------
      scale_bias : numpy.ndarray
          Packed scales/biases as the hardware requires them.
      """
      # The BYOC infra should not partition anything else.
      supported_ifm_dtypes = (np.uint8, np.int8, np.int16)
      assert ifm_dtype in supported_ifm_dtypes
  
      if weight_scales.size == 1:
          weight_scales = [weight_scales] * biases.size
  
      hw_bias_scales = _calculate_hw_bias_scales(
          ifm_scale,
          weight_scales,
          ofm_scale,
          ifm_dtype,
          is_activation_tanh_or_sigmoid,
      )
      assert len(hw_bias_scales) == biases.size
      biases = biases.astype("int64")
      packed_biases = bytearray()
      for idx, scale in enumerate(hw_bias_scales):
          packed_biases.extend(
              vapi.npu_encode_bias(biases[idx], *scale)
          )
      scale_bias = np.frombuffer(packed_biases, dtype=np.uint8)
      scale_bias = np.reshape(scale_bias, (-1, 10))
      return scale_bias
  
imports: import logging
  import math
  from typing import List, Optional, Tuple
  import numpy
  from ethosu.vela import api
  from ethosu.vela.architecture_allocator import find_block_config
  from ethosu.vela.architecture_features import Accelerator, create_default_arch
  from ethosu.vela.operation import NpuBlockType
  from ethosu.vela.register_command_stream_generator import resampling_mode_map
  from ethosu.vela.register_command_stream_util import to_kernel
  from ethosu.vela.shape4d import Shape4D
  import tvm
  from tvm.relay.backend.contrib.ethosu import tir_to_cs_translator
  from tvm.relay.backend.contrib.ethosu import util
label_desc: Use image node_id 7 for calling a global function with example usage: pack_biases(biases, ifm_scale, ifm_dtype, weight_scales, ofm_scale, is_activation_tanh_or_sigmoid) and returns: scale_bias