code: def _input_check(
      topic_term_dists,
      doc_topic_dists,
      doc_lengths,
      vocab,
      term_frequency,
  ):
      ttds = topic_term_dists.shape
      dtds = doc_topic_dists.shape
      errors = []
  
      def err(msg):
          errors.append(msg)
  
      if dtds[1] != ttds[0]:
          err_msg = (
              "Number of rows of topic_term_dists does not match number of columns of "
              "doc_topic_dists; both should be equal to the number of topics in the model."
          )
          err(err_msg)
  
      if len(doc_lengths) != dtds[0]:
          err_msg = (
              "Length of doc_lengths not equal to the number of rows in doc_topic_dists;"
              "both should be equal to the number of documents in the data."
          )
          err(err_msg)
  
      W = len(vocab)
      if ttds[1] != W:
          err_msg = (
              "Number of terms in vocabulary does not match the number of columns of "
              "topic_term_dists (where each row of topic_term_dists is a probability "
              "distribution of terms for a given topic)"
          )
          err(err_msg)
      if len(term_frequency) != W:
          err_msg = (
              "Length of term_frequency not equal to the number of terms in the "
              "number of terms in the vocabulary (len of vocab)"
          )
          err(err_msg)
  
      if __num_dist_rows__(topic_term_dists) != ttds[0]:
          err(
              "Not all rows (distributions) in topic_term_dists sum to 1."
          )
  
      if __num_dist_rows__(doc_topic_dists) != dtds[0]:
          err(
              "Not all rows (distributions) in doc_topic_dists sum to 1."
          )
  
      if len(errors) > 0:
          return errors
  
imports: import json
  import logging
  import numpy
  import pandas
  from collections import namedtuple
  from joblib import Parallel, delayed, cpu_count
  from scipy.stats import entropy
  from scipy.spatial.distance import pdist, squareform
  from sklearn.manifold import MDS, TSNE
  from pyLDAvis.utils import NumPyEncoder
label_desc: Use image node_id 2 for calling a global function with example usage: _input_check(topic_term_dists, doc_topic_dists, doc_lengths, vocab, term_frequency) and returns: errors