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

Optim.jl Causes a Strange Type Instability in norm #283

Closed
cortner opened this issue Sep 19, 2016 · 6 comments
Closed

Optim.jl Causes a Strange Type Instability in norm #283

cortner opened this issue Sep 19, 2016 · 6 comments

Comments

@cortner
Copy link
Contributor

cortner commented Sep 19, 2016

import Optim
function test_norm(R::Vector{Float64})
#         r = Base.LinAlg.vecnorm2(R)
        r = norm(R)
    return r
end
R1 = rand(3);
@code_warntype test_norm(R1)

Output is

Variables:
  #self#::#test_norm
  R::Array{Float64,1}
  r::Any

Body:
  begin
      r::Any = $(Expr(:invoke, LambdaInfo for vecnorm(::Array{Float64,1}, ::Int64), :(Base.LinAlg.vecnorm), :(R), 2)) # line 4:
      return r::Any
  end::Any

Comments:

  • With vecnorm2 the type of r is inferred correctly.
  • If I don't import Optim first, then the type is also inferred correctly.
  • This happens on v0.5-rc4, but not on v0.4.6
  • It happens on Optim master as well as the current release.
@pkofod
Copy link
Member

pkofod commented Sep 19, 2016

I'm thinking JuliaLang/julia#18465 JuliaLang/julia#18449 perhaps?

@cortner
Copy link
Contributor Author

cortner commented Sep 20, 2016

yes, it is fixed in the nightly.

@pkofod
Copy link
Member

pkofod commented Sep 20, 2016

Well... yeah... Good to know it is fixed at least :)

@cortner
Copy link
Contributor Author

cortner commented Sep 20, 2016

Before closing here, can we wait until it is clear that 0.5 will backport the fix?

@pkofod
Copy link
Member

pkofod commented Sep 20, 2016

Yes, let's keep it open.

@pkofod
Copy link
Member

pkofod commented Jan 28, 2017

Well, there doesn't seem to be any 0.5.x before 0.6.0. It's fixed on v0.6 so I guess I might as well just close this, as v0.6 should be "just around the corner".

@pkofod pkofod closed this as completed Jan 28, 2017
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

2 participants