# How to implement Deep Adaptive Input Normalization?

**URL:** <https://community.konduit.ai/t/how-to-implement-deep-adaptive-input-normalization/1730>\
**Category:** DL4J\
**Created:** [December 29, 2021, 4:33pm UTC](https://community.konduit.ai/t/how-to-implement-deep-adaptive-input-normalization/1730 "2021-12-29T16:33:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kgoderis](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@kgoderis](https://community.konduit.ai/u/kgoderis)\
**Post date:** [December 29, 2021, 4:33pm UTC](https://community.konduit.ai/t/how-to-implement-deep-adaptive-input-normalization/1730/1 "2021-12-29T16:33:58Z")

</div>

I want to implement DAIN, which is a flexible way to normalise data that is fed to a network, as opposed to the “fixed” normalisation methods like MinMax scaling and alike, and put that in front of an LSTM based network that does take in essence [mini batch size, # features, sequence length] inputs.

What is the best approach to do this?

A python implementation (and link to paper) is at [GitHub - passalis/dain: Deep Adaptive Input Normalization for Time Series Forecasting](https://github.com/passalis/dain)

In extension of this, I was also wondering what is the best approach to implement [https://github.com/Nicholas-Picini/Temporal-Attention-time-series-analysis](https://github.com/Nicholas-Picini/Temporal-Attention-time-series-analysis) in DL4J?

Tx  
K

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [December 29, 2021, 5:22pm UTC](https://community.konduit.ai/t/how-to-implement-deep-adaptive-input-normalization/1730/2 "2021-12-29T17:22:20Z")

</div>

The regular normalizer feature of DL4J will be not uesful in this case.

I think the best way to approach it is probably to use a SameDiffLayer and just specify the necessary computations in there.
