• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pymc-devs / pymc3 / 9386

pending completion
9386

Pull #3634

travis-ci

web-flow
WIP: refactoring the DifferentialEquation Op
+ full support for test_values
+ explicit input/output types
+ 2D return shape
+ optional return of sensitivities
+ gradient without helper Op
Pull Request #3634: [WIP] DifferentialEquation Op improvements

99 of 99 new or added lines in 3 files covered. (100.0%)

42609 of 80628 relevant lines covered (52.85%)

1.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pymc3/tests/test_types.py
1
from copy import copy
×
2

3
import theano
×
4

5
from pymc3.sampling import sample
×
6
from pymc3.model import Model
×
7
from pymc3.step_methods import NUTS, Metropolis, Slice, HamiltonianMC
×
8
from pymc3.distributions import Normal
×
9
from pymc3.theanof import change_flags
×
10

11
import numpy as np
×
12

13

14
class TestType:
×
15
    samplers = (Metropolis, Slice, HamiltonianMC, NUTS)
×
16

17
    def setup_method(self):
×
18
        # save theano config object
19
        self.theano_config = copy(theano.config)
×
20

21
    def teardown_method(self):
×
22
        # restore theano config
23
        theano.config = self.theano_config
×
24

25
    @change_flags({'floatX': 'float64', 'warn_float64': 'ignore'})
×
26
    def test_float64(self):
27
        with Model() as model:
×
28
            x = Normal('x', testval=np.array(1., dtype='float64'))
×
29
            obs = Normal('obs', mu=x, sigma=1., observed=np.random.randn(5))
×
30

31
        assert x.dtype == 'float64'
×
32
        assert obs.dtype == 'float64'
×
33

34
        for sampler in self.samplers:
×
35
            with model:
×
36
                sample(10, sampler())
×
37

38
    @change_flags({'floatX': 'float32', 'warn_float64': 'warn'})
×
39
    def test_float32(self):
40
        with Model() as model:
×
41
            x = Normal('x', testval=np.array(1., dtype='float32'))
×
42
            obs = Normal('obs', mu=x, sigma=1., observed=np.random.randn(5).astype('float32'))
×
43

44
        assert x.dtype == 'float32'
×
45
        assert obs.dtype == 'float32'
×
46

47
        for sampler in self.samplers:
×
48
            with model:
×
49
                sample(10, sampler())
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc