diff --git a/src/ops/math.jl b/src/ops/math.jl index a626df19..a7a52e72 100644 --- a/src/ops/math.jl +++ b/src/ops/math.jl @@ -167,7 +167,9 @@ function Base.round(::Type{T}, value::AbstractTensor) where T end --(n::AbstractTensor) = negative(n) +@op function -(n::AbstractTensor; kwargs...) + negative(n; kwargs...) +end @op function Base.complex(x_r::AbstractTensor, x_i::AbstractTensor; kwargs...) Ops.complex(x_r, x_i; kwargs...) diff --git a/test/meta.jl b/test/meta.jl index ac90d87c..4ef1adb1 100644 --- a/test/meta.jl +++ b/test/meta.jl @@ -60,7 +60,11 @@ end end end - +@testset "Negating and @tf" begin + a = constant(1) + @tf b = -a + @test true # Above line would have errored if unary - didn't work with @tf +end @testset "Naming Big Demo" begin let