-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature request
Allow maths in shape constraints.
Motivation
For example:
@check_shapes(
"left: [left_rows, left_columns]",
"right: [right_rows, right_columns]",
"return: [left_rows * right_rows, left_columns + right_columns]",
)
def cartesian_product(left, right):
....
Proposal
The ability to do maths in shape constraints.
This is hard, because we need to be able to learn/infer the values of the variables (left_rows
, left_columns
, etc...), and in general we cannot work backwards solve arbitrary equations. We could solve this in a couple of ways:
- Require the user to declare their shapes in order, so that when a shape variable is used in maths, its value is already known.
- Check shapes lazily, and only evaluate a shape when all the required information is available.
I don't like (1), because I don't like have to impose an ordering on constraints, and because optional arguments can make it hard to predict when a variable value will actually be available. I like (2) better, but it does have the disadvantage that sometimes a shape variable value may never be known, and no check actually performed.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Todo