Add more checks and clearer error messages to conv operations (#563)

* Add more checks and clearer error messages to conv operations
This commit is contained in:
Jagrit Digani
2024-01-26 15:13:26 -08:00
committed by GitHub
parent 8fa6b322b9
commit bf17ab5002
3 changed files with 38 additions and 1 deletions

View File

@@ -2930,6 +2930,10 @@ void init_ops(py::module_& m) {
throw std::invalid_argument("[convolve] Inputs must be 1D.");
}
if (a.size() == 0 || v.size() == 0) {
throw std::invalid_argument("[convolve] Inputs cannot be empty.");
}
array in = a.size() < v.size() ? v : a;
array wt = a.size() < v.size() ? a : v;
wt = slice(wt, {wt.shape(0) - 1}, {-wt.shape(0) - 1}, {-1}, s);