forked from alibaba/MNN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpandDims.cpp
More file actions
37 lines (28 loc) · 921 Bytes
/
Copy pathExpandDims.cpp
File metadata and controls
37 lines (28 loc) · 921 Bytes
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
//
// ExpandDims.cpp
// MNNConverter
//
// Created by MNN on 2019/01/31.
// Copyright © 2018, Alibaba Group Holding Limited
//
#include "TfUtils.hpp"
#include "tfOpConverter.hpp"
#include "graph.pb.h"
DECLARE_OP_CONVERTER(ExpandDimsTf);
MNN::OpType ExpandDimsTf::opType() {
return MNN::OpType_ExpandDims;
}
MNN::OpParameter ExpandDimsTf::type() {
return MNN::OpParameter_ExpandDims;
}
void ExpandDimsTf::run(MNN::OpT *dstOp, TmpNode *srcNode, TmpGraph *tempGraph) {
auto parameter = new MNN::ExpandDimsT;
TmpNode *dimNode = tempGraph->_getTmpNode(srcNode->inEdges[1]);
tensorflow::AttrValue value;
if (find_attr_value(dimNode->tfNode, "value", value)) {
const tensorflow::TensorProto &dimTensor = value.tensor();
parameter->axis = dimTensor.int_val(0);
}
dstOp->main.value = parameter;
}
REGISTER_CONVERTER(ExpandDimsTf, ExpandDims);