code: def test_viterbi_binary_multi():
      # 0 stays 0,
      # 1 is uninformative
      transition = np.asarray([[0.9, 0.1], [0.5, 0.5]])
  
      # Initial state distribution
      p_init = np.asarray([0.25, 0.75])
  
      p_binary = np.asarray([[0.25, 0.5, 0.75, 0.1, 0.1, 0.8, 0.9]])
  
      # Make a three-channel stack
      p_mc = np.stack([p_binary, 1 - p_binary, p_binary[::-1]])
  
      path, logp = librosa.sequence.viterbi_binary(
          p_mc,
          transition,
          p_state=p_init[1:],
          p_init=p_init[1:],
          return_logp=True,
      )
      path2 = librosa.sequence.viterbi_binary(
          p_mc,
          transition,
          p_state=p_init[1:],
          p_init=p_init[1:],
      )
  
      # Verify that both branches agree on path
      assert np.array_equal(path, path2)
  
      # Check each channel independently
      for i in range(len(p_mc)):
          pi, logpi = librosa.sequence.viterbi_binary(
              p_mc[i],
              transition,
              p_state=p_init[1:],
              p_init=p_init[1:],
              return_logp=True,
          )
          assert np.array_equal(path[i], pi)
          assert np.array_equal(path[i].shape, pi.shape)
          assert np.allclose(logpi, logp[i])
  
imports: import numpy
  import pytest
  from test_core import srand
  import librosa
label_desc: Use image node_id 16 for calling a global function with example usage: test_viterbi_binary_multi() without return types