Skip to content

Commit ca4325f

Browse files
maresbricardoV94
authored andcommitted
Try ignoring the unused-ignore on py3.12
1 parent 7accf52 commit ca4325f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pytensor/tensor/shape.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ def c_code_cache_version(self):
146146
def shape(x: Union[np.ndarray, Number, Variable]) -> Variable:
147147
"""Return the shape of `x`."""
148148
if not isinstance(x, Variable):
149-
x = ptb.as_tensor_variable(x) # type: ignore
149+
# The following is a type error in Python 3.9 but not 3.12.
150+
# Thus we need to ignore unused-ignore on 3.12.
151+
x = ptb.as_tensor_variable(x) # type: ignore[arg-type,unused-ignore]
150152

151153
return cast(Variable, _shape(x))
152154

@@ -579,7 +581,9 @@ def specify_shape(
579581

580582
# If the specified shape is already encoded in the input static shape, do nothing
581583
# This ignores PyTensor constants in shape
582-
x = ptb.as_tensor_variable(x) # type: ignore
584+
x = ptb.as_tensor_variable(x) # type: ignore[arg-type,unused-ignore]
585+
# The above is a type error in Python 3.9 but not 3.12.
586+
# Thus we need to ignore unused-ignore on 3.12.
583587
new_shape_info = any(
584588
s != xts for (s, xts) in zip(shape, x.type.shape) if s is not None
585589
)

0 commit comments

Comments
 (0)