Closed nogginly closed 1 year ago
Thanks for the PR @nogginly, agree this is a great feature to have, not sure why CI isn't working but this looks good to merge!
@christopherzimmerman, I added both CPU and OCL test for unary operator; is it possible that OpenCL isn't available in the CI runner?
@nogginly ah, I missed that, yes. I usually add compiler flags for tests that require additional libraries, and then don't run them as part of the standard CI, like this: {% if flag?(:opencl) %}
Got it. Let me fix that and raise a PR.
Fixes #80
@christopherzimmerman, here's a PR to add unary - (negation) operator support for CPU and OpenCL tensors. I've included test cases as well.
While
-a == (0-a)
and in fact the#negate
method for OpenCL backend does just that, I think it's worth having the unary operator available. When I ran into this, it took me a little while to grok the compiler error and realise what was happening.