order
of output array for binary elementwise funcs, clip
, and matmul
defaults to C-contiguous
#1678
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR proposes a change to
clip
,matmul
, and theBinaryElementwiseFunc
class which makesC
the default contiguity of outputs whenorder="K"
and the input arrays must be cast.This fixes a minor discrepancy where when multiple input arrays are both C- and F-contiguous and need to be cast, the output defaulted to F-contiguous instead of C-contiguous, creating unusual edge cases where type promotion (and therefore the selected device) became relevant to the output array's order, which should not be the case.
For example
The selected device's type promotion graph contains
float64
, leading to F-contiguous outputs.after this change: