MCPcopy Index your code
hub / github.com/benfred/implicit / test_cpu_gpu_conversion

Function test_cpu_gpu_conversion

tests/gpu_test.py:73–83  ·  view source on GitHub ↗
(model_class, from_gpu)

Source from the content-addressed store, hash-verified

71)
72@pytest.mark.parametrize("from_gpu", [True, False])
73def test_cpu_gpu_conversion(model_class, from_gpu):
74 model = model_class(use_gpu=from_gpu, factors=32)
75 user_plays = get_checker_board(50)
76 model.fit(user_plays)
77 converted = model.to_cpu() if from_gpu else model.to_gpu()
78 assert_allclose(
79 model.recommend(0, user_plays[0]),
80 converted.recommend(0, user_plays[0]),
81 rtol=1e-3,
82 atol=1e-3,
83 )

Callers

nothing calls this directly

Calls 5

get_checker_boardFunction · 0.90
to_gpuMethod · 0.80
fitMethod · 0.45
to_cpuMethod · 0.45
recommendMethod · 0.45

Tested by

no test coverage detected