-
Notifications
You must be signed in to change notification settings - Fork 9
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
array-api-strict flags #30
Conversation
Flags are global variables that set array-api-strict in a specific mode. Currently support flags change the support array API standard version, enable or disable data-dependent shapes, and enable or disable optional extensions. This commit only sets up the structure for setting and getting these flags.
This behavior still needs to be tested. This required moving the linalg functions that are also in the main namespace so that they can still work there even when the linalg extension is disabled. The way I've decided to implement this is that the functions will not raise an exception until they are called. It would probably be more convenient for users if they raised an attribute error, or if the extension namespace itself did, like it would in a real library without the given extension. But the implementation for this would be a lot more complicated and didn't really feel worth it to me.
array_api_strict/_flags.py
Outdated
shapes depend on the input data. | ||
|
||
This flag is enabled by default. Array libraries that use computation graphs may not be able to support | ||
functions whose output shapes depend on the input data. |
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.
stray sentence, duplicate with paragraph above
@asmeurer I think the |
This matches the name used in __array_namespace__
This is ready to go. I'm not going to implement anything for 2021.12 unless someone requests it. But using this, I can add preliminary support for 2023.12. One thing I'm not completely sure about is if someone sets a flag using an environment variable, like |
Flags are global variables that set array-api-strict in a specific mode. Currently support flags change the support array API standard version, enable or disable data-dependent shapes, and enable or disable optional extensions.
So far I have only set up the structure for setting and getting these flags. Let me know if this seems like a good API layout or not.
I plan to add functionality to the various functions to enable/disable behaviors depending on what flags are set.
Fixes #8
Fixes #7