-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streamlining axis size #545
Streamlining axis size #545
Conversation
…es are already resolved
For simplicity and consistency we (should) expect the test tensors to have singleton batch axes if their description is it. In other words, the test tensor should match the description exactly
I don't think so. I wanted that initially, but then I realized that tensors may not have an explicit (singleton) channel axis. And we'd still need the data description |
@@ -177,13 +176,35 @@ def validate_tensor_axis_id(s: str): | |||
|
|||
SAME_AS_TYPE = "<same as type>" | |||
|
|||
class FixedSize(Node): | |||
extent: int | |||
unit: "TimeUnit | SpaceUnit" #FIXME: generic? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moving the unit
into the size means we break compatibility with https://ngff.openmicroscopy.org/latest/#axes-md
I think we should try to stay directly compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is also mixing the pixel size with the unit.
the unit
should go with the scale
. together they describe the distance of two pixels/frames.
The size is intended to describe the number of pixels/frames, i.e. the tensor shape
@@ -276,51 +311,48 @@ class WithHalo(Node): | |||
class BatchAxis(AxisBase): | |||
type: Literal["batch"] = "batch" | |||
id: Annotated[AxisId, Predicate(lambda x: x == AxisId("batch"))] = AxisId("batch") | |||
size: Optional[Literal[1]] = None | |||
batch_size: Optional[Literal[1]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change the field name to batch_size
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah.. found the size property..
how about we just use ParameterizedSize(min=1, step=1)
as a default value and leave the field as size
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about we just use
ParameterizedSize(min=1, step=1)
as a default value and leave the field assize
?
But this would type this field as Optional[ParameterizedSize]
, which would allow it to be something like ParameterizedSize(min=3, step=10)
, and that seems to go against the original intention of having it be either exactly 1 or any number picked by the runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, true!
How about
class ParameterizedBatchSize(ParametrerizedSize):
min: Literal[1]
step: Literal[1]
and
class BatchAxis....
size: Union[Literal[1], ParameterizedBatchSize] = ...
?
This PR tries to streamline axis sizes, so that there are fewer special cases and so that it is easier to verify their correctness:
FixedSize | ParameterizedSize | SizeReference
;int
s orstr
s orNone
or whatver;TODO:
TensorDataDescr
intoChannelAxis