Conversation
src/ops.jl
Outdated
|
|
||
| add(xs...) = .+(xs...) | ||
| sub(xs...) = .-(xs...) | ||
| neg(x) = -1 .* x |
There was a problem hiding this comment.
Why not just -x (or .-x to be consistent with the code above)?
If you are worried about intersection with sub(xs...), me can modify all 3 functions above like this:
add(x, xs...) = .+(x, xs...)
sub(x, xs...) = .-(x, xs...)
neg(x) = -xThere was a problem hiding this comment.
Would the way we save the function on the tape be ok with both sub and neg having the same operator, i.e .-(x) .-(xs...)
There was a problem hiding this comment.
In ONNX, we have Sub(A, B) and Neg(A) - two functions with different names and different number of arguments.
In Julia, we have A - B and -A - two different methods with the same name, but still easily distinguishable by the number of arguments.
There are a few ambiguous corner cases, but in normal flow - when you use - in Julia and Subs/Neg in ONNX - these operations have perfect 1-to-1 mapping. So I don't see a reason to worry.
Adding support for the Neg layer of ONNX.
PR Checklist