forked from alibaba/MNN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNormalize.cpp
More file actions
38 lines (35 loc) · 1.14 KB
/
Copy pathNormalize.cpp
File metadata and controls
38 lines (35 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Normalize.cpp
// MNNConverter
//
// Created by MNN on 2019/01/31.
// Copyright © 2018, Alibaba Group Holding Limited
//
#include "OpConverter.hpp"
class Normalize : public OpConverter {
public:
virtual void run(MNN::OpT* dstOp, const caffe::LayerParameter& parameters, const caffe::LayerParameter& weight);
Normalize() {
}
virtual ~Normalize() {
}
virtual MNN::OpType opType() {
return MNN::OpType_Normalize;
}
virtual MNN::OpParameter type() {
return MNN::OpParameter_Normalize;
}
};
void Normalize::run(MNN::OpT* dstOp, const caffe::LayerParameter& parameters, const caffe::LayerParameter& weight) {
auto normizeT = new MNN::NormalizeT;
dstOp->main.value = normizeT;
auto& l = parameters.norm_param();
normizeT->channelShared = l.channel_shared();
normizeT->acrossSpatial = l.across_spatial();
normizeT->eps = l.eps();
auto& scaleBlob = weight.blobs(0);
for (int i = 0; i < scaleBlob.data_size(); ++i) {
normizeT->scale.push_back(scaleBlob.data(i));
}
}
static OpConverterRegister<Normalize> a("Normalize");