code: def test_viterbi_multichannel():
      # Example from https://en.wikipedia.org/wiki/Viterbi_algorithm#Example
  
      # States: 0 = healthy, 1 = fever
      p_init = np.asarray([0.6, 0.4])
  
      # state 0 = hi, state 1 = low
      transition = np.asarray([[0.7, 0.3], [0.4, 0.6]])
  
      # emission likelihoods
      emit_p = [
          dict(normal=0.5, cold=0.4, dizzy=0.1),
          dict(normal=0.1, cold=0.3, dizzy=0.6),
      ]
  
      obs = ["normal", "cold", "dizzy"]
  
      prob = np.asarray(
          [np.asarray([ep[o] for o in obs]) for ep in emit_p]
      )
  
      # Make a 3-channel stack
      prob_mc = np.stack([prob, 1 - prob, prob[:, ::-1]])
      path, logp = librosa.sequence.viterbi(
          prob_mc, transition, p_init=p_init, return_logp=True
      )
  
      # Check the second execution path
      path2 = librosa.sequence.viterbi(
          prob_mc, transition, p_init=p_init, return_logp=False
      )
      assert np.array_equal(path, path2)
  
      # Check each individual path
      path0, logp0 = librosa.sequence.viterbi(
          prob_mc[0], transition, p_init=p_init, return_logp=True
      )
      assert np.allclose(path0, path[0])
      assert np.allclose(logp0, logp[0])
  
      path1, logp1 = librosa.sequence.viterbi(
          prob_mc[1], transition, p_init=p_init, return_logp=True
      )
      assert np.allclose(path1, path[1])
      assert np.allclose(logp1, logp[1])
  
      path2, logp2 = librosa.sequence.viterbi(
          prob_mc[2], transition, p_init=p_init, return_logp=True
      )
      assert np.allclose(path2, path[2])
      assert np.allclose(logp2, logp[2])
  
imports: import numpy
  import pytest
  from test_core import srand
  import librosa
label_desc: Use image node_id 2 for calling a global function with example usage: test_viterbi_multichannel() without return types