# Flux model corresponding to PyTorch nn.BatchNorm1d

**URL:** <https://discourse.julialang.org/t/flux-model-corresponding-to-pytorch-nn-batchnorm1d/70125>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 21, 2021, 4:41am UTC](https://discourse.julialang.org/t/flux-model-corresponding-to-pytorch-nn-batchnorm1d/70125 "2021-10-21T04:41:57Z")\
**Posts on this page:** 5\
**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 21, 2021, 4:41am UTC](https://discourse.julialang.org/t/flux-model-corresponding-to-pytorch-nn-batchnorm1d/70125/1 "2021-10-21T04:41:57Z")

</div>

Flux provides several different normalization “models” to model normalization layers. Which one of them corresponds to the PyTorch’s `nn.BatchNorm1d`?

---

<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 21, 2021, 5:31am UTC](https://discourse.julialang.org/t/flux-model-corresponding-to-pytorch-nn-batchnorm1d/70125/2 "2021-10-21T05:31:10Z")

</div>

`Flux.BatchNorm` can be used in place of nn.BatchNorm1d, nn.BatchNorm2d, nn.BatchNorm3d

---

<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 21, 2021, 5:44am UTC](https://discourse.julialang.org/t/flux-model-corresponding-to-pytorch-nn-batchnorm1d/70125/3 "2021-10-21T05:44:52Z")

</div>

But PyTorch has an `affine:bool` keyword option in its `nn.BatchNorm1d`. As far as I can tell, `Flux.BatchNorm` doesn’t have that option. Is it implicitly true in Flux?

---

<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 21, 2021, 6:05am UTC](https://discourse.julialang.org/t/flux-model-corresponding-to-pytorch-nn-batchnorm1d/70125/4 "2021-10-21T06:05:21Z")

</div>

was just not documented up to a few days ago [https://github.com/FluxML/Flux.jl/pull/1729](https://github.com/FluxML/Flux.jl/pull/1729)

---

<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 21, 2021, 6:11am UTC](https://discourse.julialang.org/t/flux-model-corresponding-to-pytorch-nn-batchnorm1d/70125/5 "2021-10-21T06:11:13Z")

</div>

Ah nice. Thanks!
