# Flux.BatchNorm doesn't accept Int32 as argument

**URL:** <https://discourse.julialang.org/t/flux-batchnorm-doesnt-accept-int32-as-argument/70379>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 26, 2021, 7:09am UTC](https://discourse.julialang.org/t/flux-batchnorm-doesnt-accept-int32-as-argument/70379 "2021-10-26T07:09:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RedDocMD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/reddocmd/32/30099_2.png) [@RedDocMD](https://discourse.julialang.org/u/RedDocMD)\
**Post date:** [October 26, 2021, 7:09am UTC](https://discourse.julialang.org/t/flux-batchnorm-doesnt-accept-int32-as-argument/70379/1 "2021-10-26T07:09:55Z")

</div>

Using Flux 0.12.7, I am trying to use the `BatchNorm` layer, via the following statement:

```julia
Flux.BatchNorm(n_layers)
# I know that n_layers will have type Int32

```

However, I get the following error:

```julia
ERROR: LoadError: MethodError: no method matching BatchNorm(::Int32)
Closest candidates are:
  BatchNorm(::F, ::V, ::V, ::W, ::W, ::N, ::N, ::Bool, ::Bool, ::Union{Nothing, Bool}, ::Int64) where {F, V, N, W} at /home/dknite/.julia/packages/Flux/ZnXxS/src/layers/normalise.jl:235
  BatchNorm(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at deprecated.jl:70
  BatchNorm(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at deprecated.jl:70

```

How do I fix this?

---

<div class="post-metadata">

**Author:** ![CarloLucibello](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carlolucibello/32/3278_2.png) [@CarloLucibello](https://discourse.julialang.org/u/CarloLucibello)\
**Post date:** [October 26, 2021, 7:57am UTC](https://discourse.julialang.org/t/flux-batchnorm-doesnt-accept-int32-as-argument/70379/2 "2021-10-26T07:57:53Z")

</div>

n\_layers seems a misleading argument name, it should be n\_channels. Beside that, can’t you simply use an Int. `Flux.BatchNorm(3)`. Or convert it: `Flux.BatchNorm(Int(n_layers))`
