Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Suggestion: Add option to fail on reshape if a view could not be created #7292
INDArray#reshape often but not always returns a view of the reshaped array and this makes it is easy to introduce hard to find bugs, especially since the method purpose is so clear the user might not read the javadoc.
Would it be helpful to have a method (or maybe flag) which indicates that the user prefers an exception over a copy if a view can not be created?
I understand this adds to an already huge API so I won't cry if you don't add it. If not ,what is a good way to check that you actually get a view? INDArray#isView()?
Please indicate relevant versions, including, if relevant:
Aha! Link: https://skymindai.aha.io/features/ND4J-108
I'm in favor of adding this. We already have this functionality anyway, but it's hidden from an API perspective: