code: def _apply_vocab_at_k(
      rows: _NumbersT,
      vocab: dict[str, int],
      multioutput: bool,
      k_list: Sequence[int],
  ):
      """Encodes a multiclass(-multioutput) input in multiclass-indicator format."""
      result = np.full((len(rows), len(vocab)), False, dtype=np.bool_)
      k_list = set(k_list)
      for j in range(max(k_list)):
          if multioutput:
              for i, row in enumerate(rows):
                  if j < len(row):
                      result[i][vocab[row[j]]] = True
          else:
              if j == 0:
                  for i, elem in enumerate(rows):
                      result[i][vocab[elem]] = True
          if j + 1 in k_list:
              yield j + 1, result
  
imports: from collections.abc import Iterable, Sequence
  import dataclasses
  import enum
  import itertools
  from typing import Any
  import numpy
  from numpy import typing
  from tensorflow_model_analysis.experimental.lazytf import api
label_desc: Use image node_id 10 for calling a global function with example usage: _apply_vocab_at_k(rows, vocab, multioutput, k_list) without return types