Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distances.pairwise fails on TrackedArray #59

Open
marekdedic opened this issue Nov 19, 2019 · 0 comments
Open

Distances.pairwise fails on TrackedArray #59

marekdedic opened this issue Nov 19, 2019 · 0 comments

Comments

@marekdedic
Copy link
Contributor

julia> using Distances, Flux

julia> pairwise(SqEuclidean(), param([1 2; 3 4]), dims = 2)
ERROR: MethodError: no method matching Float64(::Tracker.TrackedReal{Float64})
Closest candidates are:
  Float64(::Real, ::RoundingMode) where T<:AbstractFloat at rounding.jl:194
  Float64(::T<:Number) where T<:Number at boot.jl:718
  Float64(::Int8) at float.jl:60
  ...
Stacktrace:
 [1] convert(::Type{Float64}, ::Tracker.TrackedReal{Float64}) at ./number.jl:7
 [2] setindex!(::Array{Float64,1}, ::Tracker.TrackedReal{Float64}, ::Int64) at ./array.jl:766
 [3] sumsq_percol(::TrackedArray{…,Array{Float64,2}}) at /home/user/.julia/packages/Distances/jwhuc/src/common.jl:107
 [4] _pairwise!(::Array{Tracker.TrackedReal{Float64},2}, ::SqEuclidean, ::TrackedArray{…,Array{Float64,2}}) at /home/user/.julia/packages/Distances/jwhuc/src/metrics.jl:600
 [5] #pairwise!#2(::Int64, ::typeof(pairwise!), ::Array{Tracker.TrackedReal{Float64},2}, ::SqEuclidean, ::TrackedArray{…,Array{Float64,2}}) at /home/user/.julia/packages/Distances/jwhuc/src/generic.jl:184
 [6] #pairwise! at ./none:0 [inlined]
 [7] #pairwise#4(::Int64, ::typeof(pairwise), ::SqEuclidean, ::TrackedArray{…,Array{Float64,2}}) at /home/user/.julia/packages/Distances/jwhuc/src/generic.jl:213
 [8] (::getfield(Distances, Symbol("#kw##pairwise")))(::NamedTuple{(:dims,),Tuple{Int64}}, ::typeof(pairwise), ::SqEuclidean, ::TrackedArray{…,Array{Float64,2}}) at ./none:0
 [9] top-level scope at REPL[2]:1

Could you please make it work? I think the problem is here, but I don't know how to fix it (probably needs to be done in Distances.jl?)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant