We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c2be97 commit 29332b1Copy full SHA for 29332b1
Project.toml
@@ -1,6 +1,6 @@
1
name = "ForwardDiff"
2
uuid = "f6369f11-7733-5829-9624-2563aa707210"
3
-version = "0.10.24"
+version = "0.10.25"
4
5
[deps]
6
CommonSubexpressions = "bbf7d656-a473-5ed7-a52c-81e309532950"
src/dual.jl
@@ -380,9 +380,9 @@ for R in (Irrational, Real, BigFloat, Bool)
380
end
381
382
383
-Base.convert(::Type{Dual{T,V,N}}, d::Dual{T}) where {T,V,N} = Dual{T}(convert(V, value(d)), convert(Partials{N,V}, partials(d)))
384
-Base.convert(::Type{Dual{T,V,N}}, x) where {T,V,N} = Dual{T}(convert(V, x), zero(Partials{N,V}))
385
-Base.convert(::Type{Dual{T,V,N}}, x::Number) where {T,V,N} = Dual{T}(convert(V, x), zero(Partials{N,V}))
+@inline Base.convert(::Type{Dual{T,V,N}}, d::Dual{T}) where {T,V,N} = Dual{T}(V(value(d)), convert(Partials{N,V}, partials(d)))
+@inline Base.convert(::Type{Dual{T,V,N}}, x) where {T,V,N} = Dual{T}(V(x), zero(Partials{N,V}))
+@inline Base.convert(::Type{Dual{T,V,N}}, x::Number) where {T,V,N} = Dual{T}(V(x), zero(Partials{N,V}))
386
Base.convert(::Type{D}, d::D) where {D<:Dual} = d
387
388
Base.float(::Type{Dual{T,V,N}}) where {T,V,N} = Dual{T,float(V),N}
test/AllocationsTest.jl
@@ -4,6 +4,8 @@ using ForwardDiff
include(joinpath(dirname(@__FILE__), "utils.jl"))
7
+convert_test_574() = convert(ForwardDiff.Dual{Nothing,ForwardDiff.Dual{Nothing,ForwardDiff.Dual{Nothing,Float64,8},4},2}, 1.3)
8
+
9
@testset "Test seed! allocations" begin
10
x = rand(1000)
11
cfg = ForwardDiff.GradientConfig(nothing, x)
@@ -28,6 +30,11 @@ include(joinpath(dirname(@__FILE__), "utils.jl"))
28
30
alloc = @allocated ForwardDiff.seed!(duals, x, index, seed)
29
31
32
@test alloc == 0
33
34
+ alloc = @allocated convert_test_574()
35
36
+ @test alloc == 0
37
38
39
-end
40
+end
0 commit comments