Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda-envs/environment-alternative-backends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
- numpyro>=0.8.0
- pandas>=0.24.0
- pip
- pytensor>=2.32.0,<2.33
- pytensor>=2.33.0,<2.34
- python-graphviz
- networkx
- rich>=13.7.1
Expand Down
2 changes: 1 addition & 1 deletion conda-envs/environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
- numpy>=1.25.0
- pandas>=0.24.0
- pip
- pytensor>=2.32.0,<2.33
- pytensor>=2.33.0,<2.34
- python-graphviz
- networkx
- scipy>=1.4.1
Expand Down
2 changes: 1 addition & 1 deletion conda-envs/environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- numpy>=1.25.0
- pandas>=0.24.0
- pip
- pytensor>=2.32.0,<2.33
- pytensor>=2.33.0,<2.34
- python-graphviz
- rich>=13.7.1
- scipy>=1.4.1
Expand Down
2 changes: 1 addition & 1 deletion conda-envs/environment-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
- pandas>=0.24.0
- pip
- polyagamma
- pytensor>=2.32.0,<2.33
- pytensor>=2.33.0,<2.34
- python-graphviz
- networkx
- rich>=13.7.1
Expand Down
2 changes: 1 addition & 1 deletion conda-envs/windows-environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
- numpy>=1.25.0
- pandas>=0.24.0
- pip
- pytensor>=2.32.0,<2.33
- pytensor>=2.33.0,<2.34
- python-graphviz
- networkx
- rich>=13.7.1
Expand Down
2 changes: 1 addition & 1 deletion conda-envs/windows-environment-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
- pandas>=0.24.0
- pip
- polyagamma
- pytensor>=2.32.0,<2.33
- pytensor>=2.33.0,<2.34
- python-graphviz
- networkx
- rich>=13.7.1
Expand Down
2 changes: 1 addition & 1 deletion pymc/distributions/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

from pytensor import Variable, clone_replace
from pytensor import tensor as pt
from pytensor.graph.basic import io_toposort
from pytensor.graph.features import ReplaceValidate
from pytensor.graph.rewriting.basic import GraphRewriter
from pytensor.graph.traversal import io_toposort
from pytensor.scan.op import Scan
from pytensor.tensor import TensorVariable, as_tensor_variable
from pytensor.tensor.random.op import RandomVariable
Expand Down
3 changes: 2 additions & 1 deletion pymc/distributions/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import pytensor
import pytensor.tensor as pt

from pytensor.graph.basic import Apply, ancestors
from pytensor.graph.basic import Apply
from pytensor.graph.replace import clone_replace
from pytensor.graph.traversal import ancestors
from pytensor.tensor import TensorVariable
from pytensor.tensor.random.op import RandomVariable
from pytensor.tensor.random.utils import normalize_size_param
Expand Down
3 changes: 2 additions & 1 deletion pymc/initial_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

from pytensor import graph_replace
from pytensor.compile.ops import TypeCastingOp
from pytensor.graph.basic import Apply, Variable, ancestors, walk
from pytensor.graph.basic import Apply, Variable
from pytensor.graph.fg import FunctionGraph
from pytensor.graph.rewriting.db import RewriteDatabaseQuery, SequenceDB
from pytensor.graph.traversal import ancestors, walk
from pytensor.tensor.variable import TensorVariable

from pymc.logprob.transforms import Transform
Expand Down
3 changes: 1 addition & 2 deletions pymc/logprob/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@
from pytensor.graph.basic import (
Constant,
Variable,
ancestors,
walk,
)
from pytensor.graph.rewriting.basic import GraphRewriter, NodeRewriter
from pytensor.graph.traversal import ancestors, walk
from pytensor.tensor.variable import TensorVariable

from pymc.logprob.abstract import (
Expand Down
3 changes: 2 additions & 1 deletion pymc/logprob/mixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@
import pytensor
import pytensor.tensor as pt

from pytensor.graph.basic import Apply, Constant, Variable, ancestors
from pytensor.graph.basic import Apply, Constant, Variable
from pytensor.graph.fg import FunctionGraph
from pytensor.graph.op import Op, compute_test_value
from pytensor.graph.rewriting.basic import EquilibriumGraphRewriter, node_rewriter
from pytensor.graph.traversal import ancestors
from pytensor.ifelse import IfElse, ifelse
from pytensor.scalar import Switch
from pytensor.scalar import switch as scalar_switch
Expand Down
7 changes: 2 additions & 5 deletions pymc/logprob/rewriting.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@
from collections.abc import Sequence

from pytensor.compile.mode import optdb
from pytensor.graph.basic import (
Variable,
ancestors,
truncated_graph_inputs,
)
from pytensor.graph.basic import Variable
from pytensor.graph.fg import FunctionGraph
from pytensor.graph.replace import clone_replace
from pytensor.graph.rewriting.basic import (
Expand All @@ -56,6 +52,7 @@
SequenceDB,
TopoDB,
)
from pytensor.graph.traversal import ancestors, truncated_graph_inputs
from pytensor.tensor.basic import Alloc
from pytensor.tensor.elemwise import DimShuffle, Elemwise
from pytensor.tensor.random.rewriting import local_subtensor_rv_lift
Expand Down
5 changes: 0 additions & 5 deletions pymc/logprob/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from pathlib import Path

from pytensor import tensor as pt
from pytensor.graph.fg import FunctionGraph
Expand Down Expand Up @@ -186,10 +185,6 @@ def find_measurable_stacks(fgraph, node) -> list[TensorVariable] | None:
class MeasurableDimShuffle(MeasurableOp, DimShuffle):
"""A placeholder used to specify a log-likelihood for a dimshuffle sub-graph."""

# Need to get the absolute path of `c_func_file`, otherwise it tries to
# find it locally and fails when a new `Op` is initialized
c_func_file = str(DimShuffle.get_path(Path(DimShuffle.c_func_file))) # type: ignore[arg-type]

def __str__(self):
return f"Measurable{super().__str__()}"

Expand Down
3 changes: 2 additions & 1 deletion pymc/logprob/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@

from pytensor import tensor as pt
from pytensor.graph import Apply, Op, node_rewriter
from pytensor.graph.basic import Constant, clone_get_equiv, graph_inputs, walk
from pytensor.graph.basic import Constant, clone_get_equiv
from pytensor.graph.fg import FunctionGraph
from pytensor.graph.traversal import graph_inputs, walk
from pytensor.link.c.type import CType
from pytensor.raise_op import CheckAndRaise
from pytensor.scalar.basic import Mul
Expand Down
3 changes: 2 additions & 1 deletion pymc/model/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

from pytensor.compile import DeepCopyOp, Function, ProfileStats, get_mode
from pytensor.compile.sharedvalue import SharedVariable
from pytensor.graph.basic import Constant, Variable, ancestors, graph_inputs
from pytensor.graph.basic import Constant, Variable
from pytensor.graph.traversal import ancestors, graph_inputs
from pytensor.tensor import as_tensor
from pytensor.tensor.math import variadic_add
from pytensor.tensor.random.op import RandomVariable
Expand Down
3 changes: 2 additions & 1 deletion pymc/model_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from typing import Any, cast

from pytensor import function
from pytensor.graph.basic import Variable, ancestors, walk
from pytensor.graph.basic import Variable
from pytensor.graph.traversal import ancestors, walk
from pytensor.tensor.shape import Shape

from pymc.model.core import modelcontext
Expand Down
3 changes: 2 additions & 1 deletion pymc/printing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from functools import partial

from pytensor.compile import SharedVariable
from pytensor.graph.basic import Constant, walk
from pytensor.graph.basic import Constant
from pytensor.graph.traversal import walk
from pytensor.tensor.basic import TensorVariable, Variable
from pytensor.tensor.elemwise import DimShuffle
from pytensor.tensor.random.basic import RandomVariable
Expand Down
3 changes: 1 addition & 2 deletions pymc/pytensorf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@
Variable,
clone_get_equiv,
equal_computations,
graph_inputs,
walk,
)
from pytensor.graph.fg import FunctionGraph, Output
from pytensor.graph.op import HasInnerGraph
from pytensor.graph.traversal import graph_inputs, walk
from pytensor.scalar.basic import Cast
from pytensor.scan.op import Scan
from pytensor.tensor.basic import _as_tensor_variable
Expand Down
4 changes: 1 addition & 3 deletions pymc/sampling/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@
Apply,
Constant,
Variable,
ancestors,
general_toposort,
walk,
)
from pytensor.graph.fg import FunctionGraph
from pytensor.graph.traversal import ancestors, general_toposort, walk
from pytensor.tensor.random.var import RandomGeneratorSharedVariable
from pytensor.tensor.sharedvar import SharedVariable, TensorSharedVariable
from pytensor.tensor.variable import TensorConstant, TensorVariable
Expand Down
2 changes: 1 addition & 1 deletion pymc/sampling/jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
from jax.lax import scan
from numpy.typing import ArrayLike
from pytensor.compile import SharedVariable, mode
from pytensor.graph.basic import graph_inputs
from pytensor.graph.fg import FunctionGraph
from pytensor.graph.replace import clone_replace
from pytensor.graph.traversal import graph_inputs
from pytensor.link.jax.dispatch import jax_funcify
from pytensor.raise_op import Assert
from pytensor.tensor import TensorVariable
Expand Down
3 changes: 2 additions & 1 deletion pymc/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
from numpy import testing as npt
from pytensor.compile import SharedVariable
from pytensor.compile.mode import Mode
from pytensor.graph.basic import Constant, Variable, equal_computations, graph_inputs
from pytensor.graph.basic import Constant, Variable, equal_computations
from pytensor.graph.rewriting.basic import in2out
from pytensor.graph.traversal import graph_inputs
from pytensor.tensor import TensorVariable
from pytensor.tensor.random.op import RandomVariable
from pytensor.tensor.random.type import RandomType
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pandas>=0.24.0
polyagamma
pre-commit>=2.8.0
pymc-sphinx-theme>=0.16.0
pytensor>=2.32.0,<2.33
pytensor>=2.33.0,<2.34
pytest-cov>=2.5
pytest>=3.0
rich>=13.7.1
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cachetools>=4.2.1
cloudpickle
numpy>=1.25.0
pandas>=0.24.0
pytensor>=2.32.0,<2.33
pytensor>=2.33.0,<2.34
rich>=13.7.1
scipy>=1.4.1
threadpoolctl>=3.1.0,<4.0.0
Expand Down
3 changes: 2 additions & 1 deletion tests/logprob/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
import pytest
import scipy.stats.distributions as sp

from pytensor.graph.basic import ancestors, equal_computations
from pytensor.graph.basic import equal_computations
from pytensor.graph.traversal import ancestors
from pytensor.tensor.random.op import RandomVariable
from scipy import stats

Expand Down
3 changes: 2 additions & 1 deletion tests/logprob/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
from pytensor import function
from pytensor import tensor as pt
from pytensor.compile import get_default_mode
from pytensor.graph.basic import ancestors, equal_computations
from pytensor.graph.basic import equal_computations
from pytensor.graph.traversal import ancestors
from pytensor.tensor.random.basic import NormalRV
from pytensor.tensor.random.op import RandomVariable

Expand Down
2 changes: 1 addition & 1 deletion tests/model/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import scipy.stats as st

from pytensor.graph import graph_inputs
from pytensor.graph.basic import get_var_by_name
from pytensor.graph.traversal import get_var_by_name
from pytensor.raise_op import Assert
from pytensor.tensor.random.op import RandomVariable
from pytensor.tensor.variable import TensorConstant
Expand Down
2 changes: 1 addition & 1 deletion tests/sampling/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from pytensor import Mode, shared
from pytensor.compile import SharedVariable
from pytensor.graph import graph_inputs
from pytensor.graph.basic import get_var_by_name, variable_depends_on
from pytensor.graph.traversal import get_var_by_name, variable_depends_on
from pytensor.tensor.variable import TensorConstant
from scipy import stats

Expand Down
Loading