Skip to content

Commit 6d3c756

Browse files
purna135ricardoV94
authored andcommitted
Rename module pytensor.tensor.var to pytensor.tensor.variable
1 parent 288a3f3 commit 6d3c756

37 files changed

+1140
-1111
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
pytensor/graph/op\.py|
1717
pytensor/compile/nanguardmode\.py|
1818
pytensor/graph/rewriting/basic\.py|
19-
pytensor/tensor/var\.py|
19+
pytensor/tensor/variable\.py|
2020
)$
2121
- id: check-merge-conflict
2222
- repo: https://github.com/asottile/pyupgrade

pytensor/link/basic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
OutputStorageType,
3131
StorageMapType,
3232
)
33-
from pytensor.tensor.var import TensorVariable
33+
from pytensor.tensor.variable import TensorVariable
3434

3535

3636
ThunkAndContainersType = Tuple["BasicThunkType", List["Container"], List["Container"]]

pytensor/link/jax/dispatch/subtensor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
def subtensor_assert_indices_jax_compatible(node, idx_list):
3535
from pytensor.graph.basic import Constant
36-
from pytensor.tensor.var import TensorVariable
36+
from pytensor.tensor.variable import TensorVariable
3737

3838
ilist = indices_from_subtensor(node.inputs[1:], idx_list)
3939
for idx in ilist:

pytensor/scan/op.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
from pytensor.tensor.math import minimum
8383
from pytensor.tensor.shape import Shape_i
8484
from pytensor.tensor.type import TensorType, integer_dtypes
85-
from pytensor.tensor.var import TensorVariable
85+
from pytensor.tensor.variable import TensorVariable
8686

8787

8888
# Logging function for sending warning or info

pytensor/scan/rewriting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
get_slice_elements,
7070
set_subtensor,
7171
)
72-
from pytensor.tensor.var import TensorConstant, get_unique_constant_value
72+
from pytensor.tensor.variable import TensorConstant, get_unique_constant_value
7373

7474

7575
list_opt_slice = [

pytensor/scan/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from pytensor.graph.utils import TestValueError
2222
from pytensor.tensor.basic import AllocEmpty, cast
2323
from pytensor.tensor.subtensor import set_subtensor
24-
from pytensor.tensor.var import TensorConstant
24+
from pytensor.tensor.variable import TensorConstant
2525

2626

2727
if TYPE_CHECKING:

pytensor/sparse/basic.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@
5151
from pytensor.tensor.type import continuous_dtypes as tensor_continuous_dtypes
5252
from pytensor.tensor.type import discrete_dtypes as tensor_discrete_dtypes
5353
from pytensor.tensor.type import iscalar, ivector, scalar, tensor, vector
54-
from pytensor.tensor.var import TensorConstant, TensorVariable, _tensor_py_operators
54+
from pytensor.tensor.variable import (
55+
TensorConstant,
56+
TensorVariable,
57+
_tensor_py_operators,
58+
)
5559

5660

5761
sparse_formats = ["csc", "csr"]

pytensor/tensor/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _get_vector_length_Constant(op: Union[Op, Variable], var: Constant) -> int:
146146
from pytensor.tensor.subtensor import * # noqa
147147
from pytensor.tensor.type import * # noqa
148148
from pytensor.tensor.type_other import * # noqa
149-
from pytensor.tensor.var import TensorConstant, TensorVariable # noqa
149+
from pytensor.tensor.variable import TensorConstant, TensorVariable # noqa
150150

151151
# Allow accessing numpy constants from pytensor.tensor
152152
from numpy import e, euler_gamma, inf, infty, nan, newaxis, pi # noqa

pytensor/tensor/basic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
uint_dtypes,
6363
values_eq_approx_always_true,
6464
)
65-
from pytensor.tensor.var import (
65+
from pytensor.tensor.variable import (
6666
TensorConstant,
6767
TensorVariable,
6868
get_unique_constant_value,

pytensor/tensor/conv/abstract_conv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
get_underlying_scalar_constant_value,
3030
)
3131
from pytensor.tensor.exceptions import NotScalarConstantError
32-
from pytensor.tensor.var import TensorConstant, TensorVariable
32+
from pytensor.tensor.variable import TensorConstant, TensorVariable
3333

3434

3535
_logger = logging.getLogger(__name__)

pytensor/tensor/elemwise.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
float_dtypes,
3030
lvector,
3131
)
32-
from pytensor.tensor.var import TensorVariable
32+
from pytensor.tensor.variable import TensorVariable
3333
from pytensor.utils import uniq
3434

3535

pytensor/tensor/extra_ops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from pytensor.tensor.math import switch
3636
from pytensor.tensor.subtensor import advanced_inc_subtensor1, set_subtensor
3737
from pytensor.tensor.type import TensorType, dvector, int_dtypes, integer_dtypes, vector
38-
from pytensor.tensor.var import TensorVariable
38+
from pytensor.tensor.variable import TensorVariable
3939
from pytensor.utils import LOCAL_BITWIDTH, PYTHON_INT_BITWIDTH
4040

4141

pytensor/tensor/fourier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from pytensor.tensor.shape import shape
1717
from pytensor.tensor.subtensor import set_subtensor
1818
from pytensor.tensor.type import TensorType, integer_dtypes
19-
from pytensor.tensor.var import TensorConstant
19+
from pytensor.tensor.variable import TensorConstant
2020

2121

2222
class Fourier(Op):

pytensor/tensor/math.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
)
4141
from pytensor.tensor.type_other import NoneConst
4242
from pytensor.tensor.utils import as_list
43-
from pytensor.tensor.var import TensorConstant, _tensor_py_operators
43+
from pytensor.tensor.variable import TensorConstant, _tensor_py_operators
4444

4545

4646
if TYPE_CHECKING:

pytensor/tensor/nlinalg.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import typing
12
from functools import partial
2-
from typing import Tuple
3+
from typing import Callable, Tuple
34

45
import numpy as np
56

@@ -299,7 +300,7 @@ class Eigh(Eig):
299300
300301
"""
301302

302-
_numop = staticmethod(np.linalg.eigh)
303+
_numop = typing.cast(Callable, staticmethod(np.linalg.eigh))
303304
__props__ = ("UPLO",)
304305

305306
def __init__(self, UPLO="L"):

pytensor/tensor/random/op.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from pytensor.tensor.shape import shape_tuple
2222
from pytensor.tensor.type import TensorType, all_dtypes
2323
from pytensor.tensor.type_other import NoneConst
24-
from pytensor.tensor.var import TensorVariable
24+
from pytensor.tensor.variable import TensorVariable
2525

2626

2727
class RandomVariable(Op):

pytensor/tensor/random/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pytensor.tensor.math import maximum
1515
from pytensor.tensor.shape import specify_shape
1616
from pytensor.tensor.type import int_dtypes
17-
from pytensor.tensor.var import TensorVariable
17+
from pytensor.tensor.variable import TensorVariable
1818

1919

2020
if TYPE_CHECKING:

pytensor/tensor/rewriting/basic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
from pytensor.tensor.shape import Shape_i, shape_padleft
7373
from pytensor.tensor.sort import TopKOp
7474
from pytensor.tensor.type import DenseTensorType, TensorType
75-
from pytensor.tensor.var import TensorConstant, TensorVariable
75+
from pytensor.tensor.variable import TensorConstant, TensorVariable
7676
from pytensor.utils import NoDuplicateOptWarningFilter
7777

7878

pytensor/tensor/rewriting/elemwise.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
register_specialize,
4040
)
4141
from pytensor.tensor.shape import shape_padleft
42-
from pytensor.tensor.var import TensorConstant, get_unique_constant_value
42+
from pytensor.tensor.variable import TensorConstant, get_unique_constant_value
4343

4444

4545
class InplaceElemwiseOptimizer(GraphRewriter):

pytensor/tensor/rewriting/jax.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pytensor.tensor.math import Sum
77
from pytensor.tensor.shape import Reshape
88
from pytensor.tensor.subtensor import AdvancedIncSubtensor, AdvancedSubtensor
9-
from pytensor.tensor.var import TensorVariable
9+
from pytensor.tensor.variable import TensorVariable
1010

1111

1212
@node_rewriter([AdvancedIncSubtensor])

pytensor/tensor/rewriting/math.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
values_eq_approx_remove_inf_nan,
102102
values_eq_approx_remove_nan,
103103
)
104-
from pytensor.tensor.var import TensorConstant, get_unique_constant_value
104+
from pytensor.tensor.variable import TensorConstant, get_unique_constant_value
105105

106106

107107
def scalarconsts_rest(inputs, elemwise=True, only_process_constants=False):

pytensor/tensor/rewriting/subtensor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
)
8282
from pytensor.tensor.type import TensorType
8383
from pytensor.tensor.type_other import NoneTypeT, SliceConstant, SliceType
84-
from pytensor.tensor.var import TensorConstant, TensorVariable
84+
from pytensor.tensor.variable import TensorConstant, TensorVariable
8585

8686

8787
def register_useless(lopt, *tags, **kwargs):

pytensor/tensor/shape.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from pytensor.tensor.exceptions import NotScalarConstantError
2020
from pytensor.tensor.type import DenseTensorType, TensorType, int_dtypes, tensor
2121
from pytensor.tensor.type_other import NoneConst
22-
from pytensor.tensor.var import TensorConstant, TensorVariable
22+
from pytensor.tensor.variable import TensorConstant, TensorVariable
2323

2424

2525
ShapeValueType = Union[None, np.integer, int, Variable]

pytensor/tensor/sharedvar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pytensor.misc.safe_asarray import _asarray
77
from pytensor.tensor import _get_vector_length
88
from pytensor.tensor.type import TensorType
9-
from pytensor.tensor.var import _tensor_py_operators
9+
from pytensor.tensor.variable import _tensor_py_operators
1010

1111

1212
def load_shared_variable(val):

pytensor/tensor/slinalg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from pytensor.tensor.nlinalg import matrix_dot
1717
from pytensor.tensor.shape import reshape
1818
from pytensor.tensor.type import matrix, tensor, vector
19-
from pytensor.tensor.var import TensorVariable
19+
from pytensor.tensor.variable import TensorVariable
2020

2121

2222
if TYPE_CHECKING:

pytensor/tensor/type.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
if TYPE_CHECKING:
1919
from numpy.typing import DTypeLike
2020

21-
from pytensor.tensor.var import TensorVariable
21+
from pytensor.tensor.variable import TensorVariable
2222

2323

2424
_logger = logging.getLogger("pytensor.tensor.type")

0 commit comments

Comments
 (0)