code: def _validate_inputs(
      ref_corpus: Union[Sequence[str], Sequence[Sequence[str]]],
      hypothesis_corpus: Union[str, Sequence[str]],
  ) -> Tuple[Sequence[Sequence[str]], Sequence[str]]:
      """Check and update (if needed) the format of reference and hypothesis corpora for various text evaluation metrics.
  
      Args:
          ref_corpus: An iterable of iterables of reference corpus.
          hypothesis_corpus: An iterable of hypothesis corpus.
  
      Return:
          ref_corpus: An iterable of iterables of reference corpus.
          hypothesis_corpus: An iterable of hypothesis corpus.
  
      Raises:
          ValueError:
              If length of `ref_corpus` and `hypothesis_corpus` differs.
  
      """
      if isinstance(hypothesis_corpus, str):
          hypothesis_corpus = [hypothesis_corpus]
  
      # Ensure reference corpus is properly of a type Sequence[Sequence[str]]
      if all(isinstance(ref, str) for ref in ref_corpus):
          ref_corpus = [ref_corpus] if len(hypothesis_corpus) == 1 else [[ref] for ref in ref_corpus]  # type: ignore
  
      if (
          hypothesis_corpus
          and all(ref for ref in ref_corpus)
          and len(ref_corpus) != len(hypothesis_corpus)
      ):
          raise ValueError(
              f"Corpus has different size {len(ref_corpus)} != {len(hypothesis_corpus)}"
          )
  
      return ref_corpus, hypothesis_corpus
  
file_path: torchmetrics/src/torchmetrics/functional/text/helper.py
imports: import math
  from enum import Enum, unique
  from typing import Dict, List, Sequence, Tuple, Union
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_inputs(ref_corpus, hypothesis_corpus) and returns: ref_corpus,  hypothesis_corpus