Skip to content

Add notes on unexpected inputs and mixing array types to Scope section #58

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

Merged
merged 1 commit into from
Nov 3, 2020

Conversation

rgommers
Copy link
Member

This question has come up multiple times already, so be explicit that we do not want to specify exception types or other behaviour resulting from unexpected usage scenarios.

@@ -126,6 +133,13 @@ extensions are dealt with_):
library switches from one array type to another, some testing and possibly
code adjustment for performance or other reasons may be needed._

- Making it possible to mix multiple array libraries in function calls.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about native Python types (int, float, bool, list)? I've been trying to avoid using them anywhere in the test suite except for full, but perhaps that is too restrictive. OTOH, float((), 1.0, dtype=float64) is more explicit about the dtype than just 1.0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. This was discussed in gh-14, with the decision that it shouldn't be allowed in functions calls, and that we'd need a special case for array + scalar (to be added to the dunder methods). I will need to double check if that's spelled out clearly enough.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: "shouldn't be allowed" --> "shouldn't be required".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this, the Python types clarification is needed. I believe it should go into the sections "Function and method signatures" and "Array object" rather than here. So I'll send a follow-up PR for that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I've just tested with TensorFlow 2.3.0 and recent JAX and CuPy; it looks like all libs now support using scalars in function calls. This needs to be stated explicitly.
  • The type promotion section says "Non-array ("scalar") operands are not permitted to participate in type promotion.", so that part is covered.

@rgommers rgommers merged commit 3f366a9 into master Nov 3, 2020
@rgommers rgommers deleted the more-non-goals branch November 3, 2020 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants