Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
04383c66
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
04383c66
编写于
7月 29, 2020
作者:
Y
yankai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix import
上级
387dac58
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
636 addition
and
42 deletion
+636
-42
mindspore/lite/src/common/anf_exporter/anf_populater/anf_reshape_populater.cc
...ommon/anf_exporter/anf_populater/anf_reshape_populater.cc
+35
-0
mindspore/lite/src/common/anf_exporter/anf_populater/anf_reshape_populater.h
...common/anf_exporter/anf_populater/anf_reshape_populater.h
+30
-0
mindspore/lite/src/common/anf_importer/import_from_protobuf.cc
...pore/lite/src/common/anf_importer/import_from_protobuf.cc
+546
-42
mindspore/lite/src/common/anf_importer/import_from_protobuf.h
...spore/lite/src/common/anf_importer/import_from_protobuf.h
+25
-0
未找到文件。
mindspore/lite/src/common/anf_exporter/anf_populater/anf_reshape_populater.cc
0 → 100644
浏览文件 @
04383c66
/**
* Copyright 2019 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/common/anf_exporter/anf_populater/anf_reshape_populater.h"
#include <vector>
#include <memory>
#include "src/common/anf_exporter/anf_populater/anf_node_populater_registry.h"
#include "ir/func_graph.h"
#include "ir/primitive.h"
namespace
mindspore
::
lite
{
int
mindspore
::
lite
::
AnfReshapePopulater
::
Parse
(
mindspore
::
CNodePtr
cnodePtr
,
schema
::
CNodeT
*
node
,
std
::
vector
<
schema
::
TensorT
*>
*
outputs
)
{
auto
attr
=
std
::
make_unique
<
schema
::
FlattenT
>
();
node
->
nodeType
=
schema
::
NodeType_CNode
;
node
->
primitive
=
std
::
make_unique
<
schema
::
PrimitiveT
>
();
node
->
primitive
->
value
.
type
=
schema
::
PrimitiveType_Flatten
;
node
->
primitive
->
value
.
value
=
attr
.
release
();
return
0
;
}
AnfNodePopulaterRegistrar
anfReshapeParser
(
"Reshape"
,
new
AnfReshapePopulater
());
}
// namespace mindspore::lite
mindspore/lite/src/common/anf_exporter/anf_populater/anf_reshape_populater.h
0 → 100644
浏览文件 @
04383c66
/**
* Copyright 2019 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_ANF_RESHAPE_PARSER_H
#define MINDSPORE_ANF_RESHAPE_PARSER_H
#include "src/common/anf_exporter/anf_populater/anf_node_populater.h"
#include <vector>
namespace
mindspore
::
lite
{
class
AnfReshapePopulater
:
public
AnfNodePopulater
{
public:
AnfReshapePopulater
()
=
default
;
~
AnfReshapePopulater
()
override
=
default
;
int
Parse
(
CNodePtr
cnodePtr
,
schema
::
CNodeT
*
node
,
std
::
vector
<
schema
::
TensorT
*>
*
outputs
)
override
;
};
}
// namespace mindspore::lite
#endif // MINDSPORE_ANF_RESHAPE_PARSER_H
mindspore/lite/src/common/anf_importer/import_from_protobuf.cc
浏览文件 @
04383c66
此差异已折叠。
点击以展开。
mindspore/lite/src/common/anf_importer/import_from_protobuf.h
浏览文件 @
04383c66
...
...
@@ -47,6 +47,7 @@ class AnfImporterFromProtobuf : public AnfImporter {
bool
ParseModelConfigureInfo
(
const
onnx
::
ModelProto
&
model_proto
);
bool
BuildFuncGraph
(
const
FuncGraphPtr
&
outputFuncGraph
,
const
onnx
::
GraphProto
&
importProto
);
#if 0
bool ImportParametersForGraph(const FuncGraphPtr &outputFuncGraph,
const onnx::GraphProto &importProto);
bool ImportNodesForGraph(const FuncGraphPtr &outputFuncGraph,
...
...
@@ -76,6 +77,30 @@ class AnfImporterFromProtobuf : public AnfImporter {
const onnx::TensorProto &attr_tensor);
std::unordered_map<std::string, abstract::AbstractTensorPtr>
GetAbstractForCNode(const onnx::AttributeProto &attr_proto);
#endif
bool
ImportParametersForGraph
(
const
FuncGraphPtr
&
outputFuncGraph
,
const
onnx
::
GraphProto
&
importProto
);
bool
ImportNodesForGraph
(
const
FuncGraphPtr
&
outputFuncGraph
,
const
onnx
::
GraphProto
&
importProto
);
bool
BuildParameterForFuncGraph
(
const
ParameterPtr
&
node
,
const
onnx
::
ValueInfoProto
&
value_proto
);
CNodePtr
BuildCNodeForFuncGraph
(
const
FuncGraphPtr
&
outputFuncGraph
,
const
onnx
::
NodeProto
&
node_proto
);
bool
BuildReturnForFuncGraph
(
const
FuncGraphPtr
&
outputFuncGraph
,
const
onnx
::
GraphProto
&
importProto
,
const
CNodePtr
&
cnode_ptr
);
bool
GetAttrValueForCNode
(
const
PrimitivePtr
&
prim
,
const
onnx
::
AttributeProto
&
attr_proto
);
bool
ObtainCNodeAttrInTypeForm
(
const
PrimitivePtr
&
prim
,
const
std
::
string
&
attr_name
,
const
onnx
::
TensorProto
&
attr_tensor
);
bool
ObtainCNodeAttrInScalarForm
(
const
PrimitivePtr
&
prim
,
const
std
::
string
&
attr_name
,
const
onnx
::
TensorProto
&
attr_tensor
);
bool
ObtainCNodeAttrInTensorForm
(
const
PrimitivePtr
&
prim
,
const
std
::
string
&
attr_name
,
const
onnx
::
TensorProto
&
attr_tensor
);
bool
BuildValueNodeForFuncGraph
(
const
onnx
::
NodeProto
&
node_proto
);
bool
ObtainValueNodeInTensorForm
(
const
string
&
value_node_name
,
const
onnx
::
TensorProto
&
attr_tensor
);
bool
ObtainValueNodeInScalarForm
(
const
string
&
value_node_name
,
const
onnx
::
TensorProto
&
attr_tensor
);
bool
GetAttrValueForValueNode
(
const
string
&
ref_attr_name
,
const
std
::
string
&
value_node_name
,
const
onnx
::
TensorProto
&
attr_tensor
);
bool
ObtainValueNodeInTypeForm
(
const
string
&
value_node_name
,
const
onnx
::
TensorProto
&
attr_tensor
);
abstract
::
AbstractTensorPtr
GetAbstractForCNode
(
const
onnx
::
AttributeProto
&
attr_proto
);
private:
std
::
string
producer_name_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录