eliminate ambiguity

This commit is contained in:
boathit 2018-03-13 10:50:56 +08:00
parent ff2caf032c
commit 2ec37790be
2 changed files with 3 additions and 1 deletions

View File

@ -61,7 +61,7 @@ for (M, f, arity) in DiffRules.diffrules()
end end
end end
# Eliminating ambiguous # Eliminating ambiguity
import Base:^ import Base:^
^(a::TrackedReal, b::Integer) = track(^, a, b) ^(a::TrackedReal, b::Integer) = track(^, a, b)

View File

@ -75,6 +75,8 @@ end
@test (param([1,2,3]) .< 2) == [true, false, false] @test (param([1,2,3]) .< 2) == [true, false, false]
@test param(2)^2 == 4.0
@testset "Intermediates" begin @testset "Intermediates" begin
x = param([1]) x = param([1])
l = sum((x .+ x).^2) l = sum((x .+ x).^2)