Add Numpy strategy for basic_indexes(shape)
#1930
Labels
new-feature
entirely novel capabilities or strategies
basic_indexes(shape)
#1930
This issue is extracted from #1829, and depends on
slices()from #1929.MyGrad defines a strategy for
basic_indexes, and we would like to bring a simpler version of it into the upstreamhypothesis.extra.numpy.Given an array shape, it generates valid indices for an array of that shape which conform to the basic (i.e. no-copy) indexing specification. Examples from this strategy shrink from indices that produce high-dimensional views of the input array, down to indices that select a single element from the array.
An initial implementation could work something like:
An optional extension would add an
allow_ellipsis=Trueflag, which picks 0-2 dims to replace with...- only a few to ensure that the resulting arrays are typically reasonably small compared to the input shape, but may still generate a slice with a length != the number of dimensions to index.np.newaxis(akaNone) is also supported to add size-1 dimensions in any position, but we would put this behind aallow_newaxis=Falseflag. As a disabled-by-default additional feature, we would prefer to receive a follow-up pull request to supportnewaxisafter the initial version is complete and released to users.The text was updated successfully, but these errors were encountered: