-
Notifications
You must be signed in to change notification settings - Fork 137
Open
Labels
Description
Description
These are available (for argsort maybe for a single axis) in the numpy public C-API:
https://numpy.org/devdocs/reference/c-api/array.html#c.PyArray_Sort
https://numpy.org/devdocs/reference/c-api/array.html#c.PyArray_ArgSort
Using it for our own ops should be simpler than the already simple SearchSorted implementation:
pytensor/pytensor/tensor/signal/conv.py
Lines 68 to 71 in afb7695
if self.mode == "full": | |
valid_conv = type(self)(mode="valid") | |
in1_bar = valid_conv(grad, in2[::-1]) | |
in2_bar = valid_conv(grad, in1[::-1]) |
Sort may act inplace, so we can add an inplace version of the Sort op as well (and be sure to copy when not enabled)