Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
d126caff
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看板
提交
d126caff
编写于
8月 19, 2020
作者:
C
chenjianping
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kernels support resize
上级
2aaba750
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
24 deletion
+21
-24
mindspore/lite/include/context.h
mindspore/lite/include/context.h
+0
-4
mindspore/lite/src/lite_kernel.h
mindspore/lite/src/lite_kernel.h
+1
-6
mindspore/lite/src/ops/primitive_c.h
mindspore/lite/src/ops/primitive_c.h
+1
-1
mindspore/lite/src/runtime/kernel/arm/base/prior_box.cc
mindspore/lite/src/runtime/kernel/arm/base/prior_box.cc
+18
-12
mindspore/lite/src/runtime/kernel/arm/base/prior_box.h
mindspore/lite/src/runtime/kernel/arm/base/prior_box.h
+1
-1
未找到文件。
mindspore/lite/include/context.h
浏览文件 @
d126caff
...
...
@@ -64,16 +64,12 @@ class MS_API Context {
/// \brief Destructor of MindSpore Lite Context.
virtual
~
Context
();
void
InferShapeInterrupt
()
{
infer_shape_interrupt_
=
true
;
}
public:
bool
float16_priority
=
true
;
/**< allow priority select float16 kernel */
DeviceContext
device_ctx_
{
DT_CPU
};
int
thread_num_
=
2
;
/**< thread number config for thread pool */
std
::
shared_ptr
<
Allocator
>
allocator
=
nullptr
;
CpuBindMode
cpu_bind_mode_
=
MID_CPU
;
bool
infer_shape_interrupt_
=
false
;
bool
running_
=
false
;
};
}
// namespace mindspore::lite
#endif // MINDSPORE_LITE_INCLUDE_CONTEXT_H_
mindspore/lite/src/lite_kernel.h
浏览文件 @
d126caff
...
...
@@ -82,9 +82,7 @@ class LiteKernel {
virtual
int
Prepare
()
{
if
(
!
InferShapeDone
())
{
(
const_cast
<
mindspore
::
lite
::
PrimitiveC
*>
(
primitive_
))
->
InferShape
(
in_tensors_
,
out_tensors_
);
if
(
need_reinit_
)
{
Init
();
}
ReSize
();
}
auto
&
outputs
=
this
->
out_tensors
();
...
...
@@ -152,8 +150,6 @@ class LiteKernel {
void
set_desc
(
const
KernelKey
kernel_key
)
{
desc_
=
kernel_key
;
}
void
set_need_reinit
()
{
need_reinit_
=
true
;
}
const
mindspore
::
lite
::
PrimitiveC
*
GetPrimitive
()
const
{
return
primitive_
;
}
protected:
...
...
@@ -170,7 +166,6 @@ class LiteKernel {
std
::
vector
<
LiteKernel
*>
in_kernels_
;
std
::
vector
<
LiteKernel
*>
out_kernels_
;
bool
train_mode_
=
false
;
bool
need_reinit_
=
false
;
bool
is_model_output_
=
false
;
};
...
...
mindspore/lite/src/ops/primitive_c.h
浏览文件 @
d126caff
...
...
@@ -57,7 +57,7 @@ class PrimitiveC {
void
SetInferFlag
(
bool
flag
);
virtual
int
InferShape
(
std
::
vector
<
lite
::
tensor
::
Tensor
*>
inputs
_
,
std
::
vector
<
lite
::
tensor
::
Tensor
*>
outputs_
);
virtual
int
InferShape
(
std
::
vector
<
lite
::
tensor
::
Tensor
*>
inputs
,
std
::
vector
<
lite
::
tensor
::
Tensor
*>
outputs
);
int
Type
()
const
;
...
...
mindspore/lite/src/runtime/kernel/arm/base/prior_box.cc
浏览文件 @
d126caff
...
...
@@ -40,16 +40,17 @@ int PriorBoxCPUKernel::Init() {
return
RET_NULL_PTR
;
}
if
(
context_
->
infer_shape_interrupt_
&&
!
context_
->
running_
)
{
set_need_reinit
();
return
RET_OK
;
}
MS_ASSERT
(
in_tensors_
.
size
()
==
kInputNum
);
MS_ASSERT
(
out_tensors_
.
size
()
==
kOutputNum
);
auto
ret
=
GeneratePriorBox
();
if
(
!
InferShapeDone
())
{
return
RET_OK
;
}
return
ReSize
();
}
return
ret
;
int
PriorBoxCPUKernel
::
ReSize
()
{
return
GeneratePriorBox
();
}
int
PriorBoxCPUKernel
::
GeneratePriorBox
()
{
...
...
@@ -158,6 +159,11 @@ int RunPriorBox(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
}
int
PriorBoxCPUKernel
::
Run
()
{
auto
prepare_ret
=
Prepare
();
if
(
prepare_ret
!=
RET_OK
)
{
MS_LOG
(
ERROR
)
<<
"Prepare fail! Ret error code["
<<
prepare_ret
<<
"]"
;
return
prepare_ret
;
}
int
error_code
=
LiteBackendParallelLaunch
(
RunPriorBox
,
this
,
thread_count_
);
if
(
error_code
!=
RET_OK
)
{
MS_LOG
(
ERROR
)
<<
"PriorBox run error, error_code["
<<
error_code
<<
"]"
;
...
...
@@ -168,18 +174,18 @@ int PriorBoxCPUKernel::Run() {
kernel
::
LiteKernel
*
CpuPriorBoxKernelCreator
(
const
std
::
vector
<
lite
::
tensor
::
Tensor
*>
&
inputs
,
const
std
::
vector
<
lite
::
tensor
::
Tensor
*>
&
outputs
,
OpParameter
*
op
P
arameter
,
const
Context
*
ctx
,
OpParameter
*
op
_p
arameter
,
const
Context
*
ctx
,
const
kernel
::
KernelKey
&
desc
,
const
mindspore
::
lite
::
PrimitiveC
*
primitive
)
{
if
(
op
P
arameter
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"Input op
P
arameter is nullptr!"
;
if
(
op
_p
arameter
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"Input op
_p
arameter is nullptr!"
;
return
nullptr
;
}
if
(
desc
.
type
!=
schema
::
PrimitiveType_PriorBox
)
{
MS_LOG
(
ERROR
)
<<
"PriorBox invalid desc type "
<<
desc
.
type
;
return
nullptr
;
}
auto
*
kernel
=
new
(
std
::
nothrow
)
PriorBoxCPUKernel
(
op
P
arameter
,
inputs
,
outputs
,
ctx
,
primitive
);
auto
*
kernel
=
new
(
std
::
nothrow
)
PriorBoxCPUKernel
(
op
_p
arameter
,
inputs
,
outputs
,
ctx
,
primitive
);
if
(
kernel
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"new PriorBoxCPUKernel fail!"
;
return
nullptr
;
...
...
@@ -187,8 +193,8 @@ kernel::LiteKernel *CpuPriorBoxKernelCreator(const std::vector<lite::tensor::Ten
auto
ret
=
kernel
->
Init
();
if
(
ret
!=
RET_OK
)
{
delete
kernel
;
MS_LOG
(
ERROR
)
<<
"Init kernel failed, name: "
<<
op
P
arameter
->
name_
<<
", type: "
<<
schema
::
EnumNamePrimitiveType
(
static_cast
<
schema
::
PrimitiveType
>
(
op
P
arameter
->
type_
));
MS_LOG
(
ERROR
)
<<
"Init kernel failed, name: "
<<
op
_p
arameter
->
name_
<<
", type: "
<<
schema
::
EnumNamePrimitiveType
(
static_cast
<
schema
::
PrimitiveType
>
(
op
_p
arameter
->
type_
));
return
nullptr
;
}
return
kernel
;
...
...
mindspore/lite/src/runtime/kernel/arm/base/prior_box.h
浏览文件 @
d126caff
...
...
@@ -36,7 +36,7 @@ class PriorBoxCPUKernel : public LiteKernel {
~
PriorBoxCPUKernel
()
=
default
;
int
Init
()
override
;
int
ReSize
()
override
{
return
0
;
}
int
ReSize
()
override
;
int
Run
()
override
;
int
PriorBoxImpl
(
int
task_id
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录