# add\_scale::Parameter check failed at: ../builder/Network.cpp::addScale::145, condition: shift...

**URL:** <https://forums.developer.nvidia.com/t/add-scale-parameter-check-failed-at-builder-network-cpp-145-condition-shift/84190>\
**Category:** TensorRT\
**Created:** [November 1, 2019, 2:30am UTC](https://forums.developer.nvidia.com/t/add-scale-parameter-check-failed-at-builder-network-cpp-145-condition-shift/84190 "2019-11-01T02:30:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![2646124438](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@2646124438](https://forums.developer.nvidia.com/u/2646124438)\
**Post date:** [November 1, 2019, 2:30am UTC](https://forums.developer.nvidia.com/t/add-scale-parameter-check-failed-at-builder-network-cpp-145-condition-shift/84190/1 "2019-11-01T02:30:15Z")

</div>

TensorRT 5.1.2.2 and GPU Gtx-1080Ti  
when I use add\_scale to implement batch nomalization layer , i get this error. how this happend and how to solve it. following is my code  
g0 = params[‘batch\_normalization\_1/gamma:0’].reshape(-1)  
m0 = params[‘batch\_normalization\_1/moving\_mean:0’].reshape(-1)  
v0 = params[‘batch\_normalization\_1/moving\_variance:0’].reshape(-1)

```
scale0 = g0 / np.sqrt(v0 + 1e-3)
shift0 = -m0 / np.sqrt(v0 + 1e-3) * g0 + params['batch_normalization_1/beta:0'].reshape(-1)
power0 = np.ones(len(g0), dtype=np.float32)
bag += [scale0, shift0, power0]

batch_norm_layer = network.add_scale(lstm_encode.get_output(0), trt.ScaleMode.CHANNEL,
                                     shift0, scale0, power0)

```

---

<div class="post-metadata">

**Author:** ![SunilJB](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/suniljb/32/14043_2.png) [@SunilJB](https://forums.developer.nvidia.com/u/SunilJB)\
**Post date:** [December 23, 2019, 5:54am UTC](https://forums.developer.nvidia.com/t/add-scale-parameter-check-failed-at-builder-network-cpp-145-condition-shift/84190/2 "2019-12-23T05:54:21Z")

</div>

Hi,  
Can you provide the following information so we can better help?  
Provide details on the platforms you are using:  
o Linux distro and version  
o GPU type  
o Nvidia driver version  
o CUDA version  
o CUDNN version  
o Python version [if using python]  
o Tensorflow and PyTorch version  
o TensorRT version

Also, if possible please share the script & model file to reproduce the issue.

Thanks
