code: def test_tsvd_fit(datatype, name, use_handle):
      if name == "blobs":
          X, y = make_blobs(
              n_samples=500000, n_features=1000, random_state=0
          )
  
      elif name == "random":
          pytest.skip(
              "fails when using random dataset "
              "used by sklearn for testing"
          )
          shape = 5000, 100
          rng = check_random_state(42)
          X = rng.randint(-100, 20, np.product(shape)).reshape(shape)
  
      else:
          n, p = 500, 5
          rng = np.random.RandomState(0)
          X = rng.randn(n, p) * 0.1 + np.array([3, 4, 2, 3, 5])
  
      if name != "blobs":
          sktsvd = skTSVD(n_components=1)
          sktsvd.fit(X)
  
      handle, stream = get_handle(use_handle)
      cutsvd = cuTSVD(n_components=1, handle=handle)
  
      cutsvd.fit(X)
      cutsvd.handle.sync()
  
      if name != "blobs":
          for attr in [
              "singular_values_",
              "components_",
              "explained_variance_ratio_",
          ]:
              with_sign = False if attr in ["components_"] else True
              assert array_equal(
                  getattr(cutsvd, attr),
                  getattr(sktsvd, attr),
                  0.4,
                  with_sign=with_sign,
              )
  
file_path: cuml/python/cuml/tests/test_tsvd.py
imports: from sklearn.utils import check_random_state
  from sklearn.decomposition import TruncatedSVD
  from sklearn.datasets import make_blobs
  from cuml.testing.utils import array_equal, unit_param, quality_param, stress_param
  from cuml.testing.utils import get_handle
  from cuml import TruncatedSVD
  import pytest
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 1 for calling a global function with example usage: test_tsvd_fit(datatype, name, use_handle) without return types