code: def test_get_absorption_state_scaling_factor(self):
      model = self._get_neural_hmm()
      (
          input_dummy,
          input_lengths,
          mel_spec,
          mel_lengths,
      ) = self._get_embedded_input()
      input_lengths = input_lengths * config_global.state_per_phone
      (
          log_c,
          log_alpha_scaled,
          transition_matrix,
          _,
      ) = model._initialize_forward_algorithm_variables(  # pylint: disable=protected-access
          mel_spec, input_dummy.shape[1] * config_global.state_per_phone
      )
      log_alpha_scaled = torch.rand_like(log_alpha_scaled).clamp(1e-3)
      transition_matrix = (
          torch.randn_like(transition_matrix).sigmoid().log()
      )
      sum_final_log_c = model.get_absorption_state_scaling_factor(
          mel_lengths,
          log_alpha_scaled,
          input_lengths,
          transition_matrix,
      )
  
      text_mask = ~sequence_mask(input_lengths)
      transition_prob_mask = ~model.get_mask_for_last_item(
          input_lengths, device=input_lengths.device
      )
  
      outputs = []
  
      for i in range(input_dummy.shape[0]):
          last_log_alpha_scaled = log_alpha_scaled[
              i, mel_lengths[i] - 1
          ].masked_fill(text_mask[i], -float("inf"))
          log_last_transition_probability = OverflowUtils.log_clamped(
              torch.sigmoid(transition_matrix[i, mel_lengths[i] - 1])
          ).masked_fill(transition_prob_mask[i], -float("inf"))
          outputs.append(
              last_log_alpha_scaled + log_last_transition_probability
          )
  
      sum_final_log_c_computed = torch.logsumexp(
          torch.stack(outputs), dim=1
      )
  
      self.assertTrue(
          torch.isclose(sum_final_log_c_computed, sum_final_log_c).all()
      )
  
imports: import os
  import random
  import unittest
  from copy import deepcopy
  import torch
  from tests import get_tests_output_path
  from TTS.tts.configs.overflow_config import OverflowConfig
  from TTS.tts.layers.overflow.common_layers import Encoder, Outputnet, OverflowUtils
  from TTS.tts.layers.overflow.decoder import Decoder
  from TTS.tts.layers.overflow.neural_hmm import EmissionModel, NeuralHMM, TransitionModel
  from TTS.tts.models.overflow import Overflow
  from TTS.tts.utils.helpers import sequence_mask
  from TTS.utils.audio import AudioProcessor
label_desc: Use image node_id 10 for calling the TestNeuralHMM obj's underlying member method code with example usage: obj.test_get_absorption_state_scaling_factor() without return types