# Error in Array

**URL:** <https://discourse.julialang.org/t/error-in-array/25770>\
**Category:** General Usage\
**Created:** [June 27, 2019, 4:34pm UTC](https://discourse.julialang.org/t/error-in-array/25770 "2019-06-27T16:34:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmedbulbul52](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@ahmedbulbul52](https://discourse.julialang.org/u/ahmedbulbul52)\
**Post date:** [June 27, 2019, 4:34pm UTC](https://discourse.julialang.org/t/error-in-array/25770/1 "2019-06-27T16:34:34Z")

</div>

ERROR: TypeError: fitdbm: in typeassert, expected Array{Int64,1}, got Array{Int64,2}  
in trainpartdbm

function trainpartdbm(mat;partitions::Array{Array{Int64,1},1}=[collect(1:size(mat)[2])],  
nhiddens::Array{Int64,1}=[size(mat)[2],div(size(mat)[2],10)],  
epochs::Int64=20,  
nparticles::Int64=100,  
learningrate::Float64=0.005)

```
partDBMS = Vector{BoltzmannMachines.BasicDBM}()
nhiddensmat = partitionhiddens(partitions,nhiddens)
println(nhiddensmat)
 for i=1:length(partitions)
    partx = mat[:,partitions[i]]
    
    pdbm = BoltzmannMachines.fitdbm(partx,
                                    nhiddens=nhiddensmat[i,:],
                                    epochs =epochs,
                                    nparticles=nparticles,
                                    learningrate=learningrate
                                    )
    push!(partDBMS,pdbm)
end
jointdbm = BoltzmannMachines.joindbms(partDBMS,partitions)
jointdbm,partDBMS

```

end  
end

Kinsly suggest me how to solve it. Thanks in advance

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [June 27, 2019, 5:07pm UTC](https://discourse.julialang.org/t/error-in-array/25770/2 "2019-06-27T17:07:04Z")

</div>

> ```julia
> expected Array{Int64,1}, got Array{Int64,2}
> 
> ```

This means that you are passing a matrix (an `Array{Int64, 2}` which is the same as a `Matrix{Int64}`) to a function which expects a vector (an `Array{Int64, 1}` which is the same as a `Vector{Int64}`).

However, without being able to see the full inputs or error message, it’s difficult to say how to fix it. Please take a look at [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757)
