Skip to content

Commit

Permalink
handle batchnorm scale_factor zero, fix Tencent#302
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Apr 27, 2018
1 parent 8f56e00 commit b560252
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/caffe/caffe2ncnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ int main(int argc, char** argv)
}
else
{
float scale_factor = 1 / binlayer.blobs(2).data().data()[0];
float scale_factor = binlayer.blobs(2).data().data()[0] == 0 ? 0 : 1 / binlayer.blobs(2).data().data()[0];
// premultiply scale_factor to mean and variance
float tmp;
for (int j=0; j<mean_blob.data_size(); j++)
Expand Down

0 comments on commit b560252

Please sign in to comment.