Skip to content

Commit 18e363a

Browse files
committed
added elif
1 parent c195048 commit 18e363a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pymc/distributions/shape_utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,28 +451,26 @@ def convert_shape(shape: Shape) -> Optional[WeakShape]:
451451
return None
452452
if isinstance(shape, int) or (isinstance(size, TensorVariable) and shape.ndim == 0):
453453
shape = (shape,)
454-
if isinstance(shape, TensorVariable) and shape.ndim == 1:
454+
elif isinstance(shape, TensorVariable) and shape.ndim == 1:
455455
shape = tuple(shape)
456456
elif isinstance(shape, (list, tuple)):
457457
shape = tuple(shape)
458458
else:
459459
raise ValueError(
460460
f"The `shape` parameter must be a tuple, TensorVariable, int or list. Actual: {type(shape)}"
461461
)
462-
463462
if isinstance(shape, tuple) and any(s == Ellipsis for s in shape[:-1]):
464463
raise ValueError(
465464
f"Ellipsis in `shape` may only appear in the last position. Actual: {shape}"
466465
)
467-
468466
return shape
469467

470468

471469
def convert_size(size: Size) -> Optional[StrongSize]:
472470
"""Process a user-provided size variable into None or a valid size object."""
473471
if size is None:
474472
return None
475-
if isinstance(size, int) or (isinstance(size, TensorVariable) and size.ndim == 0):
473+
elif isinstance(size, int) or (isinstance(size, TensorVariable) and size.ndim == 0):
476474
size = (size,)
477475
elif isinstance(size, TensorVariable) and size.ndim == 1:
478476
size = tuple(size)

0 commit comments

Comments
 (0)