Skip to content

Commit 5ea7852

Browse files
committed
refactor deprecated api
1 parent f97023a commit 5ea7852

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

pytensor/tensor/basic.py

+8-15
Original file line numberDiff line numberDiff line change
@@ -2673,36 +2673,29 @@ def vertical_stack(*args):
26732673
return concatenate(_args, axis=0)
26742674

26752675

2676-
def is_flat(var, ndim=None, outdim=None):
2676+
def is_flat(var, ndim=1):
26772677
"""
26782678
Verifies the dimensionality of the var is equal to
2679-
outdim. This method is usually called after flatten method on a
2680-
variable, where the first outdim-1 dimension size(s) of the variable
2679+
ndim. This method is usually called after flatten method on a
2680+
variable, where the first ndim-1 dimension size(s) of the variable
26812681
is kept intact, and the last dimension size of the variable is made
26822682
equal to the multiplication of its remaining dimension size(s), such that
2683-
the variable would end up with as many dimension as outdim.
2683+
the variable would end up with as many dimension as ndim.
26842684
26852685
Parameters
26862686
----------
2687-
var : pytensor.tensor.var.TensorVariable
2688-
the pytensor var on which the dimensionality is checked.
2687+
var : pytensor.tensor.var.TensorVariable
2688+
the pytensor var on which the dimensionality is checked.
26892689
2690-
outdim : int
2691-
the expected dimensionality of var.
2690+
ndim : int
2691+
the expected dimensionality of var.
26922692
26932693
Returns
26942694
-------
26952695
bool
26962696
the comparison result of var's dim
26972697
and the expected outdim.
26982698
"""
2699-
if outdim is None and ndim is None:
2700-
ndim = 1
2701-
elif outdim is not None and ndim is not None:
2702-
raise ValueError("You should only specify ndim")
2703-
elif outdim is not None:
2704-
warnings.warn("outdim` is deprecated; use `ndim` instead.")
2705-
ndim = outdim
27062699
return var.ndim == ndim
27072700

27082701

0 commit comments

Comments
 (0)