MethodError

question

#1
julia>xtrnFeatures = zeros(1,1,4096,100);
julia> ypred = forw(:vgg_model,xtrnZeroPad[:,:,:,1:100],weights);
julia> size(ypred)
(1, 1, 4096, 100)
julia>typeof(ypred)
KnetArray{Float32,4}
julia> xtrnFeatures[:,:,:,item:item+nbatch-1] = ypred;
ERROR: MethodError: no method matching setindex_shape_check(::KnetArray{Float32,4}, ::Int64, ::Int64, ::Int64, ::Int64)
Closest candidates are:
  setindex_shape_check(::AbstractArray, ::Integer...) at indices.jl:154
  setindex_shape_check(::AbstractArray{#s57,1} where #s57, ::Integer, ::Integer) at indices.jl:196
  setindex_shape_check(::AbstractArray{#s57,2} where #s57, ::Integer, ::Integer) at indices.jl:200
  ...
Stacktrace:
 [1] macro expansion at ./multidimensional.jl:641 [inlined]
 [2] _unsafe_setindex!(::IndexLinear, ::Array{Float64,4}, ::KnetArray{Float32,4}, ::Base.Slice{Base.OneTo{Int64}}, ::Base.Slice{Base.OneTo{Int64}}, ::Base.Slice{Base.OneTo{Int64}}, ::UnitRange{Int64}) at ./multidimensional.jl:636
 [3] _setindex! at ./multidimensional.jl:631 [inlined]
 [4] setindex!(::Array{Float64,4}, ::KnetArray{Float32,4}, ::Function, ::Function, ::Function, ::UnitRange{Int64}) at ./abstractarray.jl:998
 [5] top-level scope at none:0

#2

Please make a simple self-contained example.


#3

Perhaps something to add to that list of things to do is “write a descriptive title.” This is extensively covered in SO, but the title for this post is nearly useless (both for people wanting to answer questions and for later users searching for solutions).


#4

thank you. i will correct it