forked from alibaba/MNN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsStringTf.cpp
More file actions
50 lines (36 loc) · 1.2 KB
/
Copy pathAsStringTf.cpp
File metadata and controls
50 lines (36 loc) · 1.2 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
39
40
41
42
43
44
45
46
47
48
49
50
//
// AsStringTf.cpp
// MNNConverter
//
// Created by MNN on 2019/01/31.
// Copyright © 2018, Alibaba Group Holding Limited
//
#include <string.h>
#include "TfUtils.hpp"
#include "tfOpConverter.hpp"
#include "graph.pb.h"
DECLARE_OP_CONVERTER(AsStringTf);
MNN::OpType AsStringTf::opType() {
return MNN::OpType_AsString;
}
MNN::OpParameter AsStringTf::type() {
return MNN::OpParameter_AsString;
}
void AsStringTf::run(MNN::OpT *dstOp, TmpNode *srcNode, TmpGraph *tempGraph) {
auto parameter = new MNN::AsStringT;
tensorflow::AttrValue value;
find_attr_value(srcNode->tfNode, "T", value);
parameter->T = (MNN::DataType)value.type();
find_attr_value(srcNode->tfNode, "precision", value);
parameter->precision = value.i();
find_attr_value(srcNode->tfNode, "scientific", value);
parameter->scientific = value.b();
find_attr_value(srcNode->tfNode, "shortest", value);
parameter->shortest = value.b();
find_attr_value(srcNode->tfNode, "width", value);
parameter->width = value.i();
find_attr_value(srcNode->tfNode, "fillString", value);
parameter->fillString = value.s();
dstOp->main.value = parameter;
}
REGISTER_CONVERTER(AsStringTf, AsString);