# Freezing specific parameters in a layer

**URL:** <https://discourse.julialang.org/t/freezing-specific-parameters-in-a-layer/42790>\
**Category:** New to Julia\
**Created:** [July 9, 2020, 3:39pm UTC](https://discourse.julialang.org/t/freezing-specific-parameters-in-a-layer/42790 "2020-07-09T15:39:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quark/32/16268_2.png) [@quark](https://discourse.julialang.org/u/quark)\
**Post date:** [July 9, 2020, 3:39pm UTC](https://discourse.julialang.org/t/freezing-specific-parameters-in-a-layer/42790/1 "2020-07-09T15:39:08Z")

</div>

Hey!

I am new to Julia and I’ve been playing around with Flux library. What I am trying to do now is to freeze specific weights that I want. I found a function that is supposed to do that: delete!(params, model), but with it I can only freeze all the weights for a layer, but can’t get it to work for specific weigths. So I decided to look into the source code of delete!() and try to understand how everything works and I think that I understand the general idea. However there is a problem that I have and I can’t seem to understand why it works that way

So at first I define my model

m = Chain(  
Dense(10, 5, relu),  
Dense(5, 2))

and get the weigths for the first layer.

ps = Flux.params(m[1].W)

But when I do an if statement of

if m[1].W in ps.params

it returns true, while when I do an if statement of

if m[1].W[1:5, 1:10] in ps.params

I get false. I can’t seem to understand why it works that way since both are arrays that have the same elements and same dimensions. Thanks in advance !
