Julia Tensors.jl Vec

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/mifangdebaise/article/details/85093836

JuliaTensors.jl 掉用 Vec 有个很奇怪的事情:

julia> using Tensors

julia> Vec{2}([1,3])
2-element Tensor{1,2,Int64,2}:
 1
 3

julia> Vec{2,Int}([1,3])
ERROR: MethodError: no method matching Tensor{1,2,Int64,2}(::Array{Int64,1})
Closest candidates are:
  Tensor{1,2,Int64,2}(::Tuple{Vararg{T,N}} where T where N) where {order, dim, T, M} at /Users/yczhang/.julia/packages/Tensors/EOKLk/src/Tensors.jl:65
  Tensor{1,2,Int64,2}(::Function) where {order, dim, T, M} at /Users/yczhang/.julia/packages/Tensors/EOKLk/src/Tensors.jl:66
Stacktrace:
 [1] top-level scope at none:0

julia> Vec{2,Int}((1,3))
2-element Tensor{1,2,Int64,2}:
 1
 3

猜你喜欢

转载自blog.csdn.net/mifangdebaise/article/details/85093836
今日推荐