Skip to content

Commit

Permalink
Merge pull request opencv#10940 from dkurt:dnn_tf_graph_optim
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Mar 14, 2018
2 parents ab110c0 + ab20d2a commit d68466b
Show file tree
Hide file tree
Showing 5 changed files with 696 additions and 134 deletions.
6 changes: 3 additions & 3 deletions modules/dnn/src/layers/batch_norm_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BatchNormLayerImpl : public BatchNormLayer
BatchNormLayerImpl(const LayerParams& params)
{
setParamsFrom(params);
CV_Assert(blobs.size() >= 3);
CV_Assert(blobs.size() >= 2);

hasWeights = params.get<bool>("has_weight", false);
hasBias = params.get<bool>("has_bias", false);
Expand All @@ -46,8 +46,8 @@ class BatchNormLayerImpl : public BatchNormLayer
blobs[0].type() == CV_32F && blobs[1].type() == CV_32F);

float varMeanScale = 1.f;
if (!hasWeights && !hasBias) {
CV_Assert(blobs[2].type() == CV_32F);
if (!hasWeights && !hasBias && blobs.size() > 2) {
CV_Assert(blobs.size() == 3, blobs[2].type() == CV_32F);
varMeanScale = blobs[2].at<float>(0);
if (varMeanScale != 0)
varMeanScale = 1/varMeanScale;
Expand Down
Loading

0 comments on commit d68466b

Please sign in to comment.