# MethodError

**URL:** <https://discourse.julialang.org/t/methoderror/17555>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 15, 2018, 12:01pm UTC](https://discourse.julialang.org/t/methoderror/17555 "2018-11-15T12:01:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lannisite110](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lannisite110](https://discourse.julialang.org/u/lannisite110)\
**Post date:** [November 15, 2018, 12:01pm UTC](https://discourse.julialang.org/t/methoderror/17555/1 "2018-11-15T12:01:38Z")

</div>

```julia
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

```

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [November 15, 2018, 1:41pm UTC](https://discourse.julialang.org/t/methoderror/17555/2 "2018-11-15T13:41:08Z")

</div>

Please make a simple _self-contained_ example.

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [November 15, 2018, 5:49pm UTC](https://discourse.julialang.org/t/methoderror/17555/3 "2018-11-15T17:49:20Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![lannisite110](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lannisite110](https://discourse.julialang.org/u/lannisite110)\
**Post date:** [November 16, 2018, 2:30am UTC](https://discourse.julialang.org/t/methoderror/17555/4 "2018-11-16T02:30:25Z")

</div>

thank you. i will correct it
