code: def _get_batch_ranks(
      batch_logits: np.ndarray, batch_labels: np.ndarray
  ) -> np.ndarray:
      """Returns the ranks of tokens in a batch of sequences.
  
      Args:
        batch_logits: Logits returned by a seq2seq model, dim = (num_sequences,
          num_tokens, vocab_size).
        batch_labels: Target labels for the seq2seq model, dim = (num_sequences,
          num_tokens, 1).
  
      Returns:
        An array of ranks of tokens in a batch of sequences, dim = (num_sequences,
        num_tokens, 1)
      """
      batch_ranks = []
      for sequence_logits, sequence_labels in zip(
          batch_logits, batch_labels
      ):
          batch_ranks += _get_ranks_for_sequence(
              sequence_logits, sequence_labels
          )
  
      return np.array(batch_ranks)
  
imports: import dataclasses
  from typing import Iterator, List, Optional, Tuple
  import numpy
  from scipy import stats
  import tensorflow
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import membership_inference_attack
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackInputData
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResults
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackType
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import PrivacyReportMetadata
label_desc: Use image node_id 3 for calling a global function with example usage: _get_batch_ranks(batch_logits, batch_labels) and returns: np