# How to add a BatchNorm layer after a 1D CNN layer?

**URL:** <https://community.konduit.ai/t/how-to-add-a-batchnorm-layer-after-a-1d-cnn-layer/3381>\
**Category:** DL4J\
**Created:** [July 28, 2025, 7:01am UTC](https://community.konduit.ai/t/how-to-add-a-batchnorm-layer-after-a-1d-cnn-layer/3381 "2025-07-28T07:01:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cqiaoYc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/cqiaoyc/32/738_2.png) [@cqiaoYc](https://community.konduit.ai/u/cqiaoYc)\
**Post date:** [July 28, 2025, 7:01am UTC](https://community.konduit.ai/t/how-to-add-a-batchnorm-layer-after-a-1d-cnn-layer/3381/1 "2025-07-28T07:01:53Z")

</div>

How can I add a BatchNormalization layer after a 1D CNN layer? The BatchNormalization layer is designed for 2D CNNs by default, and adding it directly after a 1D CNN layer throws an error complaining about incompatible input shapes.

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [July 30, 2025, 10:47am UTC](https://community.konduit.ai/t/how-to-add-a-batchnorm-layer-after-a-1d-cnn-layer/3381/2 "2025-07-30T10:47:33Z")

</div>

@cqiaoYc which api are you using? computation graph or samediff? You could try using snapshots.

Try:

``  
` <repositories>`  
` <repository>`  
` <id>central-portal-snapshots</id>`  
` <name>Central Portal Snapshots</name>`  
` <url>` [Repository - Sonatype Nexus Repository](https://central.sonatype.com/repository/maven-snapshots/) `</url>`  
` <releases>`  
` <enabled>false</enabled>`  
` </releases>`  
` <snapshots>`  
` <enabled>true</enabled>`  
` </snapshots>`  
` </repository>`  
` </repositories>`  
```

Use org.eclipse.deeplearning4j for the groupId imports should still be the same. I remember fixing a BUNCH of bugs with keras import and 1d cnns.

---

<div class="post-metadata">

**Author:** ![cqiaoYc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/cqiaoyc/32/738_2.png) [@cqiaoYc](https://community.konduit.ai/u/cqiaoYc)\
**Post date:** [July 31, 2025, 9:56am UTC](https://community.konduit.ai/t/how-to-add-a-batchnorm-layer-after-a-1d-cnn-layer/3381/3 "2025-07-31T09:56:46Z")

</div>

@agibsonccc I am using the NeuralNetConfiguration class, Version:

```auto
      <dependency>
            <groupId>org.deeplearning4j</groupId>
            <artifactId>deeplearning4j-core</artifactId>
            <version>1.0.0-M2.1</version>
      </dependency>

```

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [July 31, 2025, 10:41am UTC](https://community.konduit.ai/t/how-to-add-a-batchnorm-layer-after-a-1d-cnn-layer/3381/4 "2025-07-31T10:41:36Z")

</div>

@cqiaoYc yeah I’m aware. I’m saying I fixed a bunch of bugs in snapshots and you can give that a try. The namespace will change in the next release to org.eclipse.deeplearning4j though.

The imports won’t change for now though. I’m making a transition release before doing that refactoring.
