Skip to content

Unnecessary deprecation warning while transposing non-numeric array #17834

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

Closed
shashi opened this issue Aug 5, 2016 · 8 comments
Closed

Unnecessary deprecation warning while transposing non-numeric array #17834

shashi opened this issue Aug 5, 2016 · 8 comments

Comments

@shashi
Copy link
Contributor

shashi commented Aug 5, 2016

julia> ["x"]'
WARNING: the no-op `transpose` fallback is deprecated, and no more specific `transpose` method for String exists. Consider `permutedim
s(x, [2, 1])` or writing a specific `transpose(x::String)` method if appropriate.
 in depwarn(::String, ::Symbol) at ./deprecated.jl:64
 in transpose(::String) at ./deprecated.jl:771
 in ctranspose at ./operators.jl:300 [inlined]
 in (::Base.##209#210)(::Tuple{Int64,String}) at ./<missing>:0
 in copy!(::Array{String,2}, ::Base.Generator{Base.Prod2{UnitRange{Int64},Array{String,1}},Base.##209#210}) at ./abstractarray.jl:394
 in ctranspose(::Array{String,1}) at ./arraymath.jl:276
 in eval(::Module, ::Any) at ./boot.jl:234
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
 in macro expansion at ./REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:46
while loading no file, in expression starting on line 0
1×1 Array{String,2}:
 "x"
Julia Version 0.6.0-dev.6
Commit 76fedd3 (2016-08-04 08:01 UTC)
Platform Info:
  System: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, sandybridge)
@yuyichao
Copy link
Contributor

yuyichao commented Aug 5, 2016

I'm under the impression that this is intentional?

@shashi
Copy link
Contributor Author

shashi commented Aug 5, 2016

transpose(x) = x is deprecated but transpose(x::Array) calls transpose on the elements of x which calls the deprecated method. I don't know if anyone uses the no-op method intentionally, the deprecation could probably be removed since that method is an implementation detail...

@tkelman
Copy link
Contributor

tkelman commented Aug 5, 2016

removing an intentional deprecation would unfix the issue "remove default no op transpose."

what's wrong with doing what the deprecation says and using permutedims?

@shashi
Copy link
Contributor Author

shashi commented Aug 5, 2016

Oh I misinterpreted the warning and thought it's suggesting permutedims("string", [2,1]). I guess this is okay, closing.

@shashi shashi closed this as completed Aug 5, 2016
@samoconnor
Copy link
Contributor

@shashi I came across this problem too.
What was your solution for applying transposing a non-numeric array?
I can't figure out from the documentation why ["foo", "bar"]' is not allowed or how to use permutedims.

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0 (2016-09-19 18:14 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-apple-darwin13.4.0

julia> x = ["foo", "bar"]
2-element Array{String,1}:
 "foo"
 "bar"

julia> x'
WARNING: the no-op `transpose` fallback is deprecated, and no more specific `transpose` method for String exists. Consider `permutedims(x, [2, 1])` or writing a specific `transpose(x::String)` method if appropriate.
 in depwarn(::String, ::Symbol) at ./deprecated.jl:64
 in transpose(::String) at ./deprecated.jl:770
 in ctranspose at ./operators.jl:315 [inlined]
 in (::Base.##209#210)(::Tuple{Int64,String}) at ./<missing>:0
 in copy!(::Array{String,2}, ::Base.Generator{Base.Prod2{Base.OneTo{Int64},Array{String,1}},Base.##209#210}) at ./abstractarray.jl:477
 in _collect(::Type{String}, ::Base.Generator{Base.Prod2{Base.OneTo{Int64},Array{String,1}},Base.##209#210}, ::Base.HasShape) at ./array.jl:251
 in ctranspose(::Array{String,1}) at ./arraymath.jl:417
 in eval(::Module, ::Any) at ./boot.jl:234
 in eval(::Module, ::Any) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
 in macro expansion at ./REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68
while loading no file, in expression starting on line 0
1×2 Array{String,2}:
 "foo"  "bar"

julia> permutedims(x, [2,1])
ERROR: ArgumentError: no valid permutation of dimensions
 in permutedims(::Array{String,1}, ::Array{Int64,1}) at ./multidimensional.jl:961

@samoconnor
Copy link
Contributor

hcat(["foo", "bar"]...) seems to work

@andreasnoack
Copy link
Member

@samoconnor See f1544bc

@samoconnor
Copy link
Contributor

#18320

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

5 participants