Fix the accelerate dispatch for the power op (#70)

- The exponent and base were swapped because accelerate is using
  exponent-base instead of base-exponent
- Fix also the test for binary ops as it was testing op(x, x) which
  couldn't catch ordering errors like that
This commit is contained in:
Angelos Katharopoulos
2023-12-08 10:58:03 -08:00
committed by GitHub
parent 4e3bdb560c
commit 209404239b
2 changed files with 22 additions and 16 deletions

View File

@@ -494,7 +494,7 @@ void Power::eval_cpu(const std::vector<array>& inputs, array& out) {
b.flags().row_contiguous) {
int size = a.size();
out.set_data(allocator::malloc_or_wait(out.nbytes()));
vvpowf(out.data<float>(), a.data<float>(), b.data<float>(), &size);
vvpowf(out.data<float>(), b.data<float>(), a.data<float>(), &size);
} else {
eval(inputs, out);
}