mirror of https://github.com/explosion/spaCy.git
Add tests for prefer_gpu() and require_gpu()
This commit is contained in:
parent
62c70b3163
commit
91593b7378
|
@ -7,6 +7,7 @@ from .. import displacy
|
||||||
from ..tokens import Span
|
from ..tokens import Span
|
||||||
from .util import get_doc
|
from .util import get_doc
|
||||||
from .._ml import PrecomputableAffine
|
from .._ml import PrecomputableAffine
|
||||||
|
from .. import prefer_gpu, require_gpu
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -101,3 +102,10 @@ def test_PrecomputableAffine(nO=4, nI=5, nF=3, nP=2):
|
||||||
assert model.d_pad[0, 2, 0, 0] == 0.
|
assert model.d_pad[0, 2, 0, 0] == 0.
|
||||||
model._backprop_padding(dY, ids)
|
model._backprop_padding(dY, ids)
|
||||||
assert model.d_pad[0, 2, 0, 0] == 3.
|
assert model.d_pad[0, 2, 0, 0] == 3.
|
||||||
|
|
||||||
|
def test_prefer_gpu():
|
||||||
|
assert not prefer_gpu()
|
||||||
|
|
||||||
|
def test_require_gpu():
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
require_gpu()
|
||||||
|
|
Loading…
Reference in New Issue