Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OAID
Tengine
提交
05757e32
T
Tengine
项目概览
OAID
/
Tengine
10 个月 前同步成功
通知
53
Star
4429
Fork
1032
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
05757e32
编写于
5月 09, 2021
作者:
B
BUG1989
提交者:
GitHub
5月 09, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support resize, scale op for TIM-VX (#653)
上级
78e2c2eb
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
135 addition
and
2 deletion
+135
-2
source/device/tim-vx/op/timvx_resize.cc
source/device/tim-vx/op/timvx_resize.cc
+71
-0
source/device/tim-vx/op/timvx_scale.cc
source/device/tim-vx/op/timvx_scale.cc
+54
-0
source/device/tim-vx/timvx_executor.cc
source/device/tim-vx/timvx_executor.cc
+6
-0
source/device/tim-vx/timvx_executor.hpp
source/device/tim-vx/timvx_executor.hpp
+2
-0
source/device/tim-vx/timvx_limit.hpp
source/device/tim-vx/timvx_limit.hpp
+2
-2
未找到文件。
source/device/tim-vx/op/timvx_resize.cc
0 → 100644
浏览文件 @
05757e32
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/*
* Copyright (c) 2021, Open AI Lab
* Author: hhchen@openailab.com
*/
#include "timvx_executor.hpp"
extern
"C"
{
#include "operator/op.h"
#include "resize_param.h"
}
bool
VXEngine
::
AddResizeNode
(
struct
node
*
ir_node
)
{
struct
graph
*
ir_graph
=
ir_node
->
graph
;
struct
tensor
*
output_tensor
=
get_ir_graph_tensor
(
ir_graph
,
ir_node
->
output_tensors
[
0
]);
struct
resize_param
*
param
=
(
struct
resize_param
*
)
ir_node
->
op
.
param_mem
;
tim
::
vx
::
ResizeType
resize_type
;
if
(
param
->
type
==
0
)
{
resize_type
=
tim
::
vx
::
ResizeType
::
NEAREST_NEIGHBOR
;
}
else
if
(
param
->
type
==
1
)
{
resize_type
=
tim
::
vx
::
ResizeType
::
BILINEAR
;
}
else
{
TLOG_ERR
(
"Tengine: VX does not support resize type(%d).
\n
"
,
(
int
)
resize_type
);
}
std
::
vector
<
std
::
shared_ptr
<
tim
::
vx
::
Tensor
>
>
add_in_tensor
(
ir_node
->
input_num
);
for
(
int
i
=
0
;
i
<
ir_node
->
input_num
;
i
++
)
{
struct
tensor
*
input_tensor
=
get_ir_graph_tensor
(
ir_graph
,
ir_node
->
input_tensors
[
i
]);
add_in_tensor
[
i
]
=
this
->
vx_tensor_map
[
input_tensor
->
index
];
}
auto
resize
=
graph
->
CreateOperation
<
tim
::
vx
::
ops
::
Resize
>
(
resize_type
,
0.0
f
,
false
,
false
,
output_tensor
->
dims
[
2
],
output_tensor
->
dims
[
3
]);
vx_node_map
[
ir_node
->
index
]
=
resize
;
(
*
resize
)
.
BindInputs
(
add_in_tensor
)
.
BindOutputs
({
this
->
vx_tensor_map
[
output_tensor
->
index
]
});
return
true
;
}
source/device/tim-vx/op/timvx_scale.cc
0 → 100644
浏览文件 @
05757e32
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/*
* Copyright (c) 2021, Open AI Lab
* Author: hhchen@openailab.com
*/
#include "timvx_executor.hpp"
extern
"C"
{
#include "operator/op.h"
}
bool
VXEngine
::
AddScaleNode
(
struct
node
*
ir_node
)
{
struct
graph
*
ir_graph
=
ir_node
->
graph
;
struct
tensor
*
input_tensor
=
get_ir_graph_tensor
(
ir_graph
,
ir_node
->
input_tensors
[
0
]);
struct
tensor
*
output_tensor
=
get_ir_graph_tensor
(
ir_graph
,
ir_node
->
output_tensors
[
0
]);
std
::
vector
<
uint32_t
>
perm
;
for
(
int
i
=
output_tensor
->
dim_num
-
1
;
i
>=
0
;
i
--
)
{
perm
.
push_back
(
output_tensor
->
dims
[
i
]);
}
auto
reshape
=
graph
->
CreateOperation
<
tim
::
vx
::
ops
::
Reshape
>
(
perm
);
vx_node_map
[
ir_node
->
index
]
=
reshape
;
(
*
reshape
)
.
BindInputs
({
this
->
vx_tensor_map
[
input_tensor
->
index
]
})
.
BindOutputs
({
this
->
vx_tensor_map
[
output_tensor
->
index
]
});
return
true
;
}
source/device/tim-vx/timvx_executor.cc
浏览文件 @
05757e32
...
...
@@ -230,6 +230,12 @@ int VXEngine::Build(struct subgraph* subgraph)
case
OP_RESHAPE
:
this
->
AddReshapeNode
(
ir_node
);
break
;
case
OP_RESIZE
:
this
->
AddResizeNode
(
ir_node
);
break
;
case
OP_SCALE
:
this
->
AddScaleNode
(
ir_node
);
break
;
case
OP_SIGMOID
:
this
->
AddSigmoidNode
(
ir_node
);
break
;
...
...
source/device/tim-vx/timvx_executor.hpp
浏览文件 @
05757e32
...
...
@@ -109,6 +109,8 @@ private:
bool
AddReluNode
(
struct
node
*
ir_node
);
bool
AddRelu1Node
(
struct
node
*
ir_node
);
bool
AddReshapeNode
(
struct
node
*
ir_node
);
bool
AddResizeNode
(
struct
node
*
ir_node
);
bool
AddScaleNode
(
struct
node
*
ir_node
);
bool
AddSigmoidNode
(
struct
node
*
ir_node
);
bool
AddSliceNode
(
struct
node
*
ir_node
);
bool
AddSoftmaxNode
(
struct
node
*
ir_node
);
...
...
source/device/tim-vx/timvx_limit.hpp
浏览文件 @
05757e32
...
...
@@ -92,14 +92,14 @@ const int timvx_supported_ops[] = {
OP_RELU6
,
// OP_REORG,
OP_RESHAPE
,
//
OP_RESIZE,
OP_RESIZE
,
// OP_REVERSE,
// OP_RNN,
// OP_ROIALIGN,
// OP_ROIPOOLING,
// OP_ROUND,
// OP_RPN,
//
OP_SCALE,
OP_SCALE
,
// OP_SELU,
// OP_SHUFFLECHANNEL,
OP_SIGMOID
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录