code: def _calculate_hw_bias_scales(
      ifm_scale: float,
      weight_scales: List[float],
      ofm_scale: float,
      ifm_dtype: np.dtype,
      is_faf_tanh_sigmoid: bool = False,
  ) -> List[Tuple[int, int]]:
      """This function will produce a scale that is calculated using scales of ifm,
      weights and ofm. It is also important to note that if per-channel / per-value
      quantization required they should go into hw bias scales"""
      if is_faf_tanh_sigmoid:
          ifm_scale = ifm_scale * 0x3000
      if ifm_dtype == np.uint8:
          bias_scales = [
              np.double(ifm_scale * ws) / np.double(ofm_scale)
              for ws in weight_scales
          ]
      else:
          assert ifm_dtype in (np.int8, np.int16)
          ifm_scale_dbl = np.double(ifm_scale)
          ofm_scale_dbl = np.double(ofm_scale)
          bias_scales = [
              ifm_scale_dbl * np.double(ws) / ofm_scale_dbl
              for ws in weight_scales
          ]
  
      if ifm_dtype == np.int16:
          hw_bias_scales = [
              _reduced_quantize_scale(bs) for bs in bias_scales
          ]
      else:
          assert ifm_dtype in (np.uint8, np.int8)
          hw_bias_scales = [_quantize_scale(bs) for bs in bias_scales]
  
      return hw_bias_scales
  
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 10 for calling a global function with example usage: _calculate_hw_bias_scales(ifm_scale, weight_scales, ofm_scale, ifm_dtype, is_faf_tanh_sigmoid) and returns: hw_bias_scales