1

This code is giving me datatype mismatch error.

const double dd = 0.225;
af::array aa = af::constant(111, 10, f32) + dd;
af::array bb = af::constant(111, 10, f64) + dd;
af::eval(aa, bb);

Both aa and bb should be f64 because both add a double value. There shouldn't be a datatype mismatch error.

I got their response on github.com/arrayfire/arrayfire/issues/2426, it remains as f32 after adding the double scalar on purpose. Anyway, it is actually a good thing for me to write program that supports precisions based on the caller's input. So, it is actually a good feature I want to keep. Marking this as resolved.

Cœur
  • 37,241
  • 25
  • 195
  • 267
BoBoDev
  • 847
  • 1
  • 8
  • 17
  • That shouldn't have happened, which version of ArrayFire are you using ? Which backend ? – pradeep Jan 23 '19 at 09:01
  • I have checked the code and it seems the developer who wrote the relevant code was intentionally falling back to single precision in the case where the second operand is a scalar even if it is double precision. If you think there are pitfalls with this behavior, please raise the issue on github. https://github.com/arrayfire/arrayfire/issues We can discuss with it our team on github issue and take it forward from there. – pradeep Jan 23 '19 at 10:22
  • That must be it. I will raise the issue on GitHub, thanks. – BoBoDev Jan 23 '19 at 21:09
  • I wrote an issue on their GitHub https://github.com/arrayfire/arrayfire/issues/2426 – BoBoDev Jan 25 '19 at 18:35
  • I got their response, it remains as f32 after adding the double scalar on purpose. You can read their justification on the link on my previous comment. Anyway, it is actually a good thing for me to write program that supports precisions based on the caller's input. So, it is actually a good feature I want to keep. Marking this as resolved. – BoBoDev Jan 25 '19 at 21:29

0 Answers0