Skip to content

Commit ce16064

Browse files
committed
refactor deprecated api
1 parent 1555a04 commit ce16064

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
@@ -2670,36 +2670,29 @@ def vertical_stack(*args):
26702670
return concatenate(_args, axis=0)
26712671

26722672

2673-
def is_flat(var, ndim=None, outdim=None):
2673+
def is_flat(var, ndim=1):
26742674
"""
26752675
Verifies the dimensionality of the var is equal to
2676-
outdim. This method is usually called after flatten method on a
2677-
variable, where the first outdim-1 dimension size(s) of the variable
2676+
ndim. This method is usually called after flatten method on a
2677+
variable, where the first ndim-1 dimension size(s) of the variable
26782678
is kept intact, and the last dimension size of the variable is made
26792679
equal to the multiplication of its remaining dimension size(s), such that
2680-
the variable would end up with as many dimension as outdim.
2680+
the variable would end up with as many dimension as ndim.
26812681
26822682
Parameters
26832683
----------
2684-
var : pytensor.tensor.var.TensorVariable
2685-
the pytensor var on which the dimensionality is checked.
2684+
var : pytensor.tensor.var.TensorVariable
2685+
the pytensor var on which the dimensionality is checked.
26862686
2687-
outdim : int
2688-
the expected dimensionality of var.
2687+
ndim : int
2688+
the expected dimensionality of var.
26892689
26902690
Returns
26912691
-------
26922692
bool
26932693
the comparison result of var's dim
26942694
and the expected outdim.
26952695
"""
2696-
if outdim is None and ndim is None:
2697-
ndim = 1
2698-
elif outdim is not None and ndim is not None:
2699-
raise ValueError("You should only specify ndim")
2700-
elif outdim is not None:
2701-
warnings.warn("outdim` is deprecated; use `ndim` instead.")
2702-
ndim = outdim
27032696
return var.ndim == ndim
27042697

27052698

0 commit comments

Comments
 (0)