code: def test_get_labels_k(
      targets, test_implicit_recs, test_implicit_labels, device
  ):
      user_ids = np.arange(test_implicit_recs.shape[0])
      k = 2
      actual_labels = _get_labels(
          targets=targets,
          user_ids=user_ids,
          preds=test_implicit_recs[:, :k],
          device=device,
      )
      expected_labels = test_implicit_labels[:, :k].to(device)
  
      assert torch.equal(actual_labels, expected_labels)
  
imports: import copy
  from functools import partial
  import re
  from unittest import mock
  import numpy
  import pytest
  from sklearn.metrics import roc_auc_score
  import torch
  import torchmetrics
  from collie.metrics import _get_evaluate_in_batches_device, _get_labels, _get_user_item_pairs, auc, evaluate_in_batches, explicit_evaluate_in_batches, get_preds, mapk, mrr
label_desc: Use image node_id 6 for calling a global function with example usage: test_get_labels_k(targets, test_implicit_recs, test_implicit_labels, device) without return types