Commit ab20d2a3 authored by Dmitry Kurtaev's avatar Dmitry Kurtaev

Update assertions in batch norm layer

parent 69a8f110
...@@ -32,7 +32,7 @@ public: ...@@ -32,7 +32,7 @@ public:
BatchNormLayerImpl(const LayerParams& params) BatchNormLayerImpl(const LayerParams& params)
{ {
setParamsFrom(params); setParamsFrom(params);
CV_Assert(blobs.size() >= 3); CV_Assert(blobs.size() >= 2);
hasWeights = params.get<bool>("has_weight", false); hasWeights = params.get<bool>("has_weight", false);
hasBias = params.get<bool>("has_bias", false); hasBias = params.get<bool>("has_bias", false);
...@@ -46,8 +46,8 @@ public: ...@@ -46,8 +46,8 @@ public:
blobs[0].type() == CV_32F && blobs[1].type() == CV_32F); blobs[0].type() == CV_32F && blobs[1].type() == CV_32F);
float varMeanScale = 1.f; float varMeanScale = 1.f;
if (!hasWeights && !hasBias) { if (!hasWeights && !hasBias && blobs.size() > 2) {
CV_Assert(blobs[2].type() == CV_32F); CV_Assert(blobs.size() == 3, blobs[2].type() == CV_32F);
varMeanScale = blobs[2].at<float>(0); varMeanScale = blobs[2].at<float>(0);
if (varMeanScale != 0) if (varMeanScale != 0)
varMeanScale = 1/varMeanScale; varMeanScale = 1/varMeanScale;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment