Skip to content

Commit f6c3bd7

Browse files
committed
do not rule out singleton axis as easily
(we cannot fail to load arrays with singleton axes because of trying to be strict)
1 parent 29de8e6 commit f6c3bd7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bioimageio/core/axis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def create(cls, axis: AxisLike) -> Axis:
7171

7272
@dataclass
7373
class AxisInfo(Axis):
74-
maybe_singleton: bool
74+
maybe_singleton: bool # TODO: replace 'maybe_singleton' with size min/max for better axis guessing
7575

7676
@classmethod
7777
def create(cls, axis: AxisLike, maybe_singleton: Optional[bool] = None) -> AxisInfo:
@@ -81,17 +81,17 @@ def create(cls, axis: AxisLike, maybe_singleton: Optional[bool] = None) -> AxisI
8181
axis_base = super().create(axis)
8282
if maybe_singleton is None:
8383
if isinstance(axis, Axis):
84-
maybe_singleton = False
84+
maybe_singleton = axis.type in ("batch", "channel", "index")
8585
elif isinstance(axis, str):
86-
maybe_singleton = axis == "b"
86+
maybe_singleton = axis in ("b", "c", "i")
8787
else:
8888
if axis.size is None:
8989
maybe_singleton = True
9090
elif isinstance(axis.size, int):
9191
maybe_singleton = axis.size == 1
9292
elif isinstance(axis.size, v0_5.SizeReference):
9393
maybe_singleton = (
94-
False # TODO: check if singleton is ok for a `SizeReference`
94+
True # TODO: check if singleton is ok for a `SizeReference`
9595
)
9696
elif isinstance(
9797
axis.size, (v0_5.ParameterizedSize, v0_5.DataDependentSize)

0 commit comments

Comments
 (0)