From 4fd56fdeccf4550953b896f9af41c8b9b65b9ed8 Mon Sep 17 00:00:00 2001 From: semohr <39738318+semohr@users.noreply.github.com> Date: Thu, 10 Dec 2020 09:08:03 +0100 Subject: [PATCH] Small compatibility fix for master of Theano-PyMc (#4293) * Update theano-pymc version * Update infer_shape signatures * Updates for new double-underscore config settings Co-authored-by: Brandon T. Willard --- .github/workflows/arviz_compat.yml | 2 +- .github/workflows/pytest.yml | 2 +- .github/workflows/windows.yml | 2 +- conda-envs/environment-dev-py36.yml | 2 +- conda-envs/environment-dev-py37.yml | 2 +- conda-envs/environment-dev-py38.yml | 2 +- pymc3/__init__.py | 4 ++-- pymc3/distributions/multivariate.py | 2 +- pymc3/math.py | 4 ++-- pymc3/ode/ode.py | 2 +- requirements.txt | 2 +- scripts/test.sh | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index 4d1046bd221..1e899568e07 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} env: TEST_SUBSET: ${{ matrix.test-subset }} - THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc.cxxflags='-march=native' + THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native' defaults: run: shell: bash -l {0} diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index e1da3c3bb05..2c16e9b6bbb 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -59,7 +59,7 @@ jobs: runs-on: ${{ matrix.os }} env: TEST_SUBSET: ${{ matrix.test-subset }} - THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc.cxxflags='-march=native' + THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native' defaults: run: shell: bash -l {0} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 83add158392..6291cc80946 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -17,7 +17,7 @@ jobs: runs-on: ${{ matrix.os }} env: TEST_SUBSET: ${{ matrix.test-subset }} - THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc.cxxflags='-march=core2' + THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=core2' defaults: run: shell: bash -l {0} diff --git a/conda-envs/environment-dev-py36.yml b/conda-envs/environment-dev-py36.yml index 77c11267a22..31f7c970985 100644 --- a/conda-envs/environment-dev-py36.yml +++ b/conda-envs/environment-dev-py36.yml @@ -5,7 +5,7 @@ channels: dependencies: - python=3.6 - arviz>=0.9 - - theano-pymc==1.0.11 + - theano-pymc==1.0.12 - numpy>=1.13 - scipy>=0.18 - pandas>=0.18 diff --git a/conda-envs/environment-dev-py37.yml b/conda-envs/environment-dev-py37.yml index 17bd6a90a11..7c8ad623321 100644 --- a/conda-envs/environment-dev-py37.yml +++ b/conda-envs/environment-dev-py37.yml @@ -5,7 +5,7 @@ channels: dependencies: - python=3.7 - arviz>=0.9 - - theano-pymc==1.0.11 + - theano-pymc==1.0.12 - numpy>=1.13 - scipy>=0.18 - pandas>=0.18 diff --git a/conda-envs/environment-dev-py38.yml b/conda-envs/environment-dev-py38.yml index 2eac820ced4..1d2176edcfd 100644 --- a/conda-envs/environment-dev-py38.yml +++ b/conda-envs/environment-dev-py38.yml @@ -5,7 +5,7 @@ channels: dependencies: - python=3.8 - arviz>=0.9 - - theano-pymc==1.0.11 + - theano-pymc==1.0.12 - numpy>=1.13 - scipy>=0.18 - pandas>=0.18 diff --git a/pymc3/__init__.py b/pymc3/__init__.py index 788526adc5b..23751b518ff 100644 --- a/pymc3/__init__.py +++ b/pymc3/__init__.py @@ -32,8 +32,8 @@ def __set_compiler_flags(): # Workarounds for Theano compiler problems on various platforms import theano - current = theano.config.gcc.cxxflags - theano.config.gcc.cxxflags = f"{current} -Wno-c++11-narrowing" + current = theano.config.gcc__cxxflags + theano.config.gcc__cxxflags = f"{current} -Wno-c++11-narrowing" __set_compiler_flags() diff --git a/pymc3/distributions/multivariate.py b/pymc3/distributions/multivariate.py index 02a9f61955a..59851b2e0c6 100755 --- a/pymc3/distributions/multivariate.py +++ b/pymc3/distributions/multivariate.py @@ -724,7 +724,7 @@ def perform(self, node, inputs, outputs): pm._log.exception("Failed to check if %s positive definite", x) raise - def infer_shape(self, node, shapes): + def infer_shape(self, fgraph, node, shapes): return [[]] def grad(self, inp, grads): diff --git a/pymc3/math.py b/pymc3/math.py index bba098678af..a8d50f03c61 100644 --- a/pymc3/math.py +++ b/pymc3/math.py @@ -363,7 +363,7 @@ def grad(self, inputs, gout): idx = tt.arange(gz.shape[-1]) return [gz[..., idx, idx]] - def infer_shape(self, nodes, shapes): + def infer_shape(self, fgraph, nodes, shapes): return [(shapes[0][0],) + (shapes[0][1],) * 2] @@ -422,7 +422,7 @@ def grad(self, inputs, gout): ] return [gout[0][slc] for slc in slices] - def infer_shape(self, nodes, shapes): + def infer_shape(self, fgraph, nodes, shapes): first, second = zip(*shapes) return [(tt.add(*first), tt.add(*second))] diff --git a/pymc3/ode/ode.py b/pymc3/ode/ode.py index 4c1c3a77f2c..e15f370ea8a 100644 --- a/pymc3/ode/ode.py +++ b/pymc3/ode/ode.py @@ -213,7 +213,7 @@ def perform(self, node, inputs_storage, output_storage): # simulate states and sensitivities in one forward pass output_storage[0][0], output_storage[1][0] = self._simulate(y0, theta) - def infer_shape(self, node, input_shapes): + def infer_shape(self, fgraph, node, input_shapes): s_y0, s_theta = input_shapes output_shapes = [(self.n_times, self.n_states), (self.n_times, self.n_states, self.n_p)] return output_shapes diff --git a/requirements.txt b/requirements.txt index f97594daf9c..ff947e26f83 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,5 @@ numpy>=1.13.0 pandas>=0.18.0 patsy>=0.5.1 scipy>=0.18.1 -theano-pymc==1.0.11 +theano-pymc==1.0.12 typing-extensions>=3.7.4 diff --git a/scripts/test.sh b/scripts/test.sh index 42b01507d8c..f9ae8111f7b 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -3,4 +3,4 @@ set -e _FLOATX=${FLOATX:=float64} -THEANO_FLAGS="floatX=${_FLOATX},gcc.cxxflags='-march=core2'" pytest -v --cov=pymc3 --cov-report=xml "$@" --cov-report term +THEANO_FLAGS="floatX=${_FLOATX},gcc__cxxflags='-march=core2'" pytest -v --cov=pymc3 --cov-report=xml "$@" --cov-report term