-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
test_text_backend.py
85 lines (62 loc) · 1.98 KB
/
test_text_backend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import pymc3 as pm
from pymc3.tests import backend_fixtures as bf
from pymc3.backends import ndarray, text
import pytest
import theano
class TestTextSampling(object):
name = 'text-db'
def test_supports_sampler_stats(self):
with pm.Model():
pm.Normal("mu", mu=0, sd=1, shape=2)
db = text.Text(self.name)
pm.sample(20, tune=10, init=None, trace=db)
def teardown_method(self):
bf.remove_file_or_directory(self.name)
class TestText0dSampling(bf.SamplingTestCase):
backend = text.Text
name = 'text-db'
shape = ()
class TestText1dSampling(bf.SamplingTestCase):
backend = text.Text
name = 'text-db'
shape = 2
class TestText2dSampling(bf.SamplingTestCase):
backend = text.Text
name = 'text-db'
shape = (2, 3)
@pytest.mark.xfail(condition=(theano.config.floatX == "float32"), reason="Fails on float32")
class TestText0dSelection(bf.SelectionTestCase):
backend = text.Text
name = 'text-db'
shape = ()
class TestText1dSelection(bf.SelectionTestCase):
backend = text.Text
name = 'text-db'
shape = 2
class TestText2dSelection(bf.SelectionTestCase):
backend = text.Text
name = 'text-db'
shape = (2, 3)
class TestTextDumpLoad(bf.DumpLoadTestCase):
backend = text.Text
load_func = staticmethod(text.load)
name = 'text-db'
shape = (2, 3)
@pytest.mark.xfail(condition=(theano.config.floatX == "float32"), reason="Fails on float32")
class TestTextDumpFunction(bf.BackendEqualityTestCase):
backend0 = backend1 = ndarray.NDArray
name0 = None
name1 = 'text-db'
shape = (2, 3)
@classmethod
def setup_class(cls):
super(TestTextDumpFunction, cls).setup_class()
text.dump(cls.name1, cls.mtrace1)
with cls.model:
cls.mtrace1 = text.load(cls.name1)
class TestNDArrayTextEquality(bf.BackendEqualityTestCase):
backend0 = ndarray.NDArray
name0 = None
backend1 = text.Text
name1 = 'text-db'
shape = (2, 3)