# How to create Dense with initialed weights in vector

**URL:** <https://discourse.julialang.org/t/how-to-create-dense-with-initialed-weights-in-vector/121290>\
**Category:** General Usage\
**Tags:** flux\
**Created:** [October 14, 2024, 1:04pm UTC](https://discourse.julialang.org/t/how-to-create-dense-with-initialed-weights-in-vector/121290 "2024-10-14T13:04:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaozhong\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/a587f6/32.png) [@Yaozhong\_Liu](https://discourse.julialang.org/u/Yaozhong_Liu)\
**Post date:** [October 14, 2024, 1:04pm UTC](https://discourse.julialang.org/t/how-to-create-dense-with-initialed-weights-in-vector/121290/1 "2024-10-14T13:04:19Z")

</div>

Hi  
I want to initialize a Dense with weights initialized.  
I don’t expect to use initializers in Flux package.  
I already have had a Float64 vector before and want to use it as weights.  
But I met error

> Blockquote  
> using Flux  
> w0 = Float64[0.1, 0.2, 0.3, 0.4]  
> nn = Dense(w0)  
> println(nn)

And error:

> Blockquote  
> ERROR: LoadError: MethodError: no method matching Dense(::Vector{Float64})  
> Closest candidates are:  
> Dense(::LinearAlgebra.Diagonal, ::Any, ::Any)  
> @ Flux ~/.julia/packages/Flux/MtsAN/src/layers/basic.jl:190  
> Dense(::LinearAlgebra.Diagonal)  
> @ Flux ~/.julia/packages/Flux/MtsAN/src/layers/basic.jl:190  
> Dense(::LinearAlgebra.Diagonal, ::Any)  
> @ Flux ~/.julia/packages/Flux/MtsAN/src/layers/basic.jl:190  
> …  
> Stacktrace:  
> [1] top-level scope trial2.jl:3

How could I solve this problem?  
Thanks
