code: def _get_user_item_pairs(
      user_ids: Union[np.array, torch.tensor],
      n_items: int,
      device: Union[str, torch.device],
  ) -> Tuple[torch.tensor, torch.tensor]:
      """
      Create tensors pairing each input user ID with each item ID.
  
      Parameters
      ----------
      user_ids: np.array or torch.tensor, 1-d
          Iterable[int] of users to score
      n_items: int
          Number of items in the training data
      device: string
          Device to store tensors on
  
      Returns
      -------
      users: torch.tensor, 1-d
          Tensor with ``n_items`` copies of each user ID
      items: torch.tensor, 1-d
          Tensor with ``len(user_ids)`` copies of each item ID
  
      Example
      -------
      .. code-block:: python
  
          >>> user_ids = np.array([10, 11, 12])
          >>> n_items = 4
          >>> user, item = _get_user_item_pairs(user_ids: user_ids, n_items: 4, device: 'cpu'):
          >>> user
          np.array([10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12])
          >>> item
          np.array([0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3])
  
      """
      # Added because sometimes we call this function with ``n_items`` as ``np.int64`` type which
      # breaks ``repeat_interleave``.
      if isinstance(n_items, np.int64):
          n_items = n_items.item()
  
      users = torch.tensor(
          user_ids,
          dtype=torch.int64,
          requires_grad=False,
          device=device,
      ).repeat_interleave(n_items)
  
      items = torch.arange(
          start=0,
          end=n_items,
          requires_grad=False,
          device=device,
      ).repeat(len(user_ids))
  
      return users, items
  
imports: from typing import Any, Callable, Iterable, List, Optional, Tuple, Union
  import warnings
  import numpy
  from scipy.sparse import csr_matrix
  import torch
  from torchmetrics import Metric
  from torchmetrics.functional import auroc
  from tqdm.auto import tqdm
  import collie
  from collie.interactions import ExplicitInteractions, Interactions, InteractionsDataLoader
  from collie.model import BasePipeline
label_desc: Use image node_id 1 for calling a global function with example usage: _get_user_item_pairs(user_ids, n_items, device) and returns: users,  items