code: def test_small_nan(use_gpu):
      # test out case where number of factors is larger than number of users:
      # https://github.com/benfred/implicit/issues/377
      user_item_matrix = coo_matrix(
          (np.ones(10), (np.arange(10), np.arange(10)))
      ).tocsr()
      als = AlternatingLeastSquares(factors=15, use_gpu=use_gpu)
      als.fit(user_item_matrix)
  
      ids, scores = als.recommend(
          0, user_item_matrix, 10, filter_already_liked_items=False
      )
  
      # shouldn't have any NaN values in the resulting dataset
      assert not np.isnan(scores).any()
  
      # first item recommended should be the liked item in the training set
      assert ids[0] == 0
  
imports: import pickle
  import unittest
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from recommender_base_test import RecommenderBaseTestMixin, get_checker_board
  from scipy.sparse import coo_matrix, csr_matrix, random
  import implicit
  from implicit.als import AlternatingLeastSquares
  from implicit.gpu import HAS_CUDA
label_desc: Use image node_id 8 for calling a global function with example usage: test_small_nan(use_gpu) without return types