code: def test_cg_nan2(use_native, use_gpu):
      # test out Nan appearing in CG code (from https://github.com/benfred/implicit/issues/106)
      Ciu = random(
          m=100,
          n=100,
          density=0.0005,
          format="coo",
          dtype=np.float32,
          random_state=42,
          data_rvs=None,
      ).T.tocsr()
  
      model = AlternatingLeastSquares(
          factors=32,
          regularization=10,
          iterations=10,
          dtype=np.float32,
          random_state=23,
          use_native=use_native,
          use_gpu=use_gpu,
      )
      model.fit(Ciu, show_progress=False)
  
      item_factors, user_factors = (
          model.item_factors,
          model.user_factors,
      )
      if use_gpu:
          item_factors, user_factors = (
              item_factors.to_numpy(),
              user_factors.to_numpy(),
          )
  
      assert np.isfinite(item_factors).all()
      assert np.isfinite(user_factors).all()
  
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 5 for calling a global function with example usage: test_cg_nan2(use_native, use_gpu) without return types