Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
e6f36e05
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看板
提交
e6f36e05
编写于
4月 27, 2020
作者:
K
kswang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change cpu kernel dir
上级
41df9c20
变更
50
隐藏空白更改
内联
并排
Showing
50 changed file
with
243 addition
and
318 deletion
+243
-318
mindspore/ccsrc/kernel/CMakeLists.txt
mindspore/ccsrc/kernel/CMakeLists.txt
+7
-1
mindspore/ccsrc/kernel/cpu/apply_momentum_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/apply_momentum_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/apply_momentum_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/apply_momentum_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/argmax_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/argmax_cpu_kernel.cc
+3
-5
mindspore/ccsrc/kernel/cpu/argmax_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/argmax_cpu_kernel.h
+7
-9
mindspore/ccsrc/kernel/cpu/bias_add_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/bias_add_cpu_kernel.cc
+5
-7
mindspore/ccsrc/kernel/cpu/bias_add_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/bias_add_cpu_kernel.h
+11
-13
mindspore/ccsrc/kernel/cpu/bias_add_grad_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/bias_add_grad_cpu_kernel.cc
+5
-7
mindspore/ccsrc/kernel/cpu/bias_add_grad_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/bias_add_grad_cpu_kernel.h
+11
-13
mindspore/ccsrc/kernel/cpu/cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/cpu_kernel.cc
+3
-5
mindspore/ccsrc/kernel/cpu/cpu_kernel.h
mindspore/ccsrc/kernel/cpu/cpu_kernel.h
+5
-7
mindspore/ccsrc/kernel/cpu/cpu_kernel_factory.cc
mindspore/ccsrc/kernel/cpu/cpu_kernel_factory.cc
+3
-5
mindspore/ccsrc/kernel/cpu/cpu_kernel_factory.h
mindspore/ccsrc/kernel/cpu/cpu_kernel_factory.h
+6
-8
mindspore/ccsrc/kernel/cpu/equal_count_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/equal_count_cpu_kernel.cc
+3
-5
mindspore/ccsrc/kernel/cpu/equal_count_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/equal_count_cpu_kernel.h
+7
-9
mindspore/ccsrc/kernel/cpu/mkldnn/conv2d_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/mkldnn/conv2d_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/conv2d_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/mkldnn/conv2d_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/conv2d_grad_filter_cpu_kernel.cc
.../ccsrc/kernel/cpu/mkldnn/conv2d_grad_filter_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/conv2d_grad_filter_cpu_kernel.h
...e/ccsrc/kernel/cpu/mkldnn/conv2d_grad_filter_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/conv2d_grad_input_cpu_kernel.cc
...e/ccsrc/kernel/cpu/mkldnn/conv2d_grad_input_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/conv2d_grad_input_cpu_kernel.h
...re/ccsrc/kernel/cpu/mkldnn/conv2d_grad_input_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/matmul_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/mkldnn/matmul_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/matmul_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/mkldnn/matmul_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/mkl_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/mkldnn/mkl_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/mkl_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/mkldnn/mkl_cpu_kernel.h
+7
-9
mindspore/ccsrc/kernel/cpu/mkldnn/mkl_kernel_engine.cc
mindspore/ccsrc/kernel/cpu/mkldnn/mkl_kernel_engine.cc
+3
-5
mindspore/ccsrc/kernel/cpu/mkldnn/mkl_kernel_engine.h
mindspore/ccsrc/kernel/cpu/mkldnn/mkl_kernel_engine.h
+2
-4
mindspore/ccsrc/kernel/cpu/mkldnn/mul_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/mkldnn/mul_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/mul_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/mkldnn/mul_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/pooling_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/mkldnn/pooling_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/pooling_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/mkldnn/pooling_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/pooling_grad_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/mkldnn/pooling_grad_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/pooling_grad_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/mkldnn/pooling_grad_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/relu_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/mkldnn/relu_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/relu_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/mkldnn/relu_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/relu_grad_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/mkldnn/relu_grad_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/relu_grad_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/mkldnn/relu_grad_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/softmax_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/mkldnn/softmax_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/softmax_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/mkldnn/softmax_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/mkldnn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.cc
...nn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.cc
+4
-6
mindspore/ccsrc/kernel/cpu/mkldnn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.h
...dnn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.h
+6
-8
mindspore/ccsrc/kernel/cpu/one_hot_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/one_hot_cpu_kernel.cc
+3
-5
mindspore/ccsrc/kernel/cpu/one_hot_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/one_hot_cpu_kernel.h
+7
-9
mindspore/ccsrc/kernel/cpu/reshape_cpu_kernel.cc
mindspore/ccsrc/kernel/cpu/reshape_cpu_kernel.cc
+3
-5
mindspore/ccsrc/kernel/cpu/reshape_cpu_kernel.h
mindspore/ccsrc/kernel/cpu/reshape_cpu_kernel.h
+7
-9
mindspore/ccsrc/session/CMakeLists.txt
mindspore/ccsrc/session/CMakeLists.txt
+7
-0
mindspore/ccsrc/session/cpu_session.cc
mindspore/ccsrc/session/cpu_session.cc
+3
-3
mindspore/ccsrc/session/cpu_session.h
mindspore/ccsrc/session/cpu_session.h
+0
-0
mindspore/ccsrc/session/session_factory.h
mindspore/ccsrc/session/session_factory.h
+0
-1
tests/ut/cpp/pre_activate/ascend/enhancer/insert_memcpy_async_for_getnext.cc
...tivate/ascend/enhancer/insert_memcpy_async_for_getnext.cc
+1
-0
未找到文件。
mindspore/ccsrc/kernel/CMakeLists.txt
浏览文件 @
e6f36e05
...
...
@@ -17,6 +17,12 @@ if (ENABLE_D)
add_compile_definitions
(
ENABLE_D
)
endif
()
if
(
ENABLE_CPU
)
file
(
GLOB_RECURSE CPU_SRC_LIST RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
"cpu/*.cc"
)
endif
()
if
(
ENABLE_GPU
)
file
(
GLOB_RECURSE CUDA_SRC_LIST RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
"gpu/*.cu"
...
...
@@ -37,4 +43,4 @@ if (ENABLE_GPU)
# add_library(_mindspore_kernel_cuda_obj OBJECT ${CUDA_SRC_LIST})
endif
()
add_library
(
_mindspore_kernel_obj OBJECT
${
KERNEL_SRC_LIST
}
${
GPU_SRC_LIST
}
${
D_SRC_LIST
}
)
add_library
(
_mindspore_kernel_obj OBJECT
${
KERNEL_SRC_LIST
}
${
CPU_SRC_LIST
}
${
GPU_SRC_LIST
}
${
D_SRC_LIST
}
)
mindspore/ccsrc/
device/cpu/kernel
/apply_momentum_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/apply_momentum_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/apply_momentum_cpu_kernel.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/apply_momentum_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
#include "common/utils.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
ApplyMomentumCPUKernel
::
InitKernel
(
const
CNodePtr
&
/*kernel_node*/
)
{}
bool
ApplyMomentumCPUKernel
::
Launch
(
const
std
::
vector
<
kernel
::
AddressPtr
>
&
inputs
,
...
...
@@ -44,6 +43,5 @@ bool ApplyMomentumCPUKernel::Launch(const std::vector<kernel::AddressPtr> &input
}
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/apply_momentum_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/apply_momentum_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_APPLY_MOMENTUM_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_APPLY_MOMENTUM_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_APPLY_MOMENTUM_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_APPLY_MOMENTUM_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
ApplyMomentumCPUKernel
:
public
MKLCPUKernel
{
public:
ApplyMomentumCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class ApplyMomentumCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
ApplyMomentum
,
ApplyMomentumCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_APPLY_MOMENTUM_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_APPLY_MOMENTUM_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/argmax_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/argmax_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/argmax_cpu_kernel.h"
#include "
kernel/cpu
/argmax_cpu_kernel.h"
#include "device/cpu/cpu_device_address.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
ArgmaxCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
shape
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -64,6 +63,5 @@ bool ArgmaxCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
}
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/argmax_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/argmax_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_ARGMAX_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_ARGMAX_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_ARGMAX_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_ARGMAX_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device
/cpu/cpu_kernel.h"
#include "
device
/cpu/cpu_kernel_factory.h"
#include "
kernel
/cpu/cpu_kernel.h"
#include "
kernel
/cpu/cpu_kernel_factory.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
ArgmaxCPUKernel
:
public
CPUKernel
{
public:
ArgmaxCPUKernel
()
=
default
;
...
...
@@ -39,8 +38,7 @@ class ArgmaxCPUKernel : public CPUKernel {
};
MS_REG_CPU_KERNEL
(
Argmax
,
ArgmaxCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_ARGMAX_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_ARGMAX_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/bias_add_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/bias_add_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -14,12 +14,11 @@
* limitations under the License.
*/
#include "
device/cpu/kernel
/bias_add_cpu_kernel.h"
#include "
kernel/cpu
/bias_add_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
void
BiasAddCpuKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
namespace
kernel
{
void
BiasAddCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
input_shape_
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
bias_shape_
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
1
);
...
...
@@ -41,7 +40,7 @@ void BiasAddCpuKernel::InitKernel(const CNodePtr &kernel_node) {
}
}
bool
BiasAddC
pu
Kernel
::
Launch
(
const
std
::
vector
<
AddressPtr
>
&
inputs
,
const
std
::
vector
<
AddressPtr
>
&
/*workspace*/
,
bool
BiasAddC
PU
Kernel
::
Launch
(
const
std
::
vector
<
AddressPtr
>
&
inputs
,
const
std
::
vector
<
AddressPtr
>
&
/*workspace*/
,
const
std
::
vector
<
AddressPtr
>
&
outputs
)
{
if
(
inputs
.
size
()
!=
2
||
outputs
.
size
()
!=
1
)
{
MS_LOG
(
EXCEPTION
)
<<
"inputs outputs size not supoort"
;
...
...
@@ -79,6 +78,5 @@ bool BiasAddCpuKernel::Launch(const std::vector<AddressPtr> &inputs, const std::
}
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/bias_add_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/bias_add_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,21 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_MINDSPORE_CCSRC_
DEVICE_CPU_KERNEL
_BIAS_ADD_CPU_KERNEL_H_
#define MINDSPORE_MINDSPORE_CCSRC_
DEVICE_CPU_KERNEL
_BIAS_ADD_CPU_KERNEL_H_
#ifndef MINDSPORE_MINDSPORE_CCSRC_
KERNEL_CPU
_BIAS_ADD_CPU_KERNEL_H_
#define MINDSPORE_MINDSPORE_CCSRC_
KERNEL_CPU
_BIAS_ADD_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device
/cpu/cpu_kernel.h"
#include "
device
/cpu/cpu_kernel_factory.h"
#include "
kernel
/cpu/cpu_kernel.h"
#include "
kernel
/cpu/cpu_kernel_factory.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
class
BiasAddCpuKernel
:
public
CPUKernel
{
namespace
kernel
{
class
BiasAddCPUKernel
:
public
CPUKernel
{
public:
BiasAddC
pu
Kernel
()
=
default
;
~
BiasAddC
pu
Kernel
()
override
=
default
;
BiasAddC
PU
Kernel
()
=
default
;
~
BiasAddC
PU
Kernel
()
override
=
default
;
void
InitKernel
(
const
CNodePtr
&
kernel_node
)
override
;
bool
Launch
(
const
std
::
vector
<
AddressPtr
>
&
inputs
,
const
std
::
vector
<
AddressPtr
>
&
workspace
,
...
...
@@ -38,8 +37,7 @@ class BiasAddCpuKernel : public CPUKernel {
std
::
vector
<
size_t
>
input_shape_
;
std
::
vector
<
size_t
>
bias_shape_
;
};
MS_REG_CPU_KERNEL
(
BiasAdd
,
BiasAddCpuKernel
);
}
// namespace cpu
}
// namespace device
MS_REG_CPU_KERNEL
(
BiasAdd
,
BiasAddCPUKernel
);
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_MINDSPORE_CCSRC_
DEVICE_CPU_KERNEL
_BIAS_ADD_CPU_KERNEL_H_
#endif // MINDSPORE_MINDSPORE_CCSRC_
KERNEL_CPU
_BIAS_ADD_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/bias_add_grad_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/bias_add_grad_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -14,12 +14,11 @@
* limitations under the License.
*/
#include "
device/cpu/kernel
/bias_add_grad_cpu_kernel.h"
#include "
kernel/cpu
/bias_add_grad_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
void
BiasAddGradCpuKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
namespace
kernel
{
void
BiasAddGradCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
input_shape_
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
if
(
input_shape_
.
size
()
!=
4
&&
input_shape_
.
size
()
!=
2
)
{
...
...
@@ -27,7 +26,7 @@ void BiasAddGradCpuKernel::InitKernel(const CNodePtr &kernel_node) {
}
}
bool
BiasAddGradC
pu
Kernel
::
Launch
(
const
std
::
vector
<
AddressPtr
>
&
inputs
,
const
std
::
vector
<
AddressPtr
>
&
/*workspace*/
,
bool
BiasAddGradC
PU
Kernel
::
Launch
(
const
std
::
vector
<
AddressPtr
>
&
inputs
,
const
std
::
vector
<
AddressPtr
>
&
/*workspace*/
,
const
std
::
vector
<
AddressPtr
>
&
outputs
)
{
if
(
inputs
.
size
()
!=
1
||
outputs
.
size
()
!=
1
)
{
MS_LOG
(
EXCEPTION
)
<<
"input output size not support"
;
...
...
@@ -65,6 +64,5 @@ bool BiasAddGradCpuKernel::Launch(const std::vector<AddressPtr> &inputs, const s
}
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/bias_add_grad_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/bias_add_grad_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -14,21 +14,20 @@
* limitations under the License.
*/
#ifndef MINDSPORE_MINDSPORE_CCSRC_
DEVICE_CPU_KERNEL
_BIASADDGRADCPUKERNEL_H_
#define MINDSPORE_MINDSPORE_CCSRC_
DEVICE_CPU_KERNEL
_BIASADDGRADCPUKERNEL_H_
#ifndef MINDSPORE_MINDSPORE_CCSRC_
KERNEL_CPU
_BIASADDGRADCPUKERNEL_H_
#define MINDSPORE_MINDSPORE_CCSRC_
KERNEL_CPU
_BIASADDGRADCPUKERNEL_H_
#include <vector>
#include <memory>
#include "
device
/cpu/cpu_kernel.h"
#include "
device
/cpu/cpu_kernel_factory.h"
#include "
kernel
/cpu/cpu_kernel.h"
#include "
kernel
/cpu/cpu_kernel_factory.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
class
BiasAddGradCpuKernel
:
public
CPUKernel
{
namespace
kernel
{
class
BiasAddGradCPUKernel
:
public
CPUKernel
{
public:
BiasAddGradC
pu
Kernel
()
=
default
;
~
BiasAddGradC
pu
Kernel
()
override
=
default
;
BiasAddGradC
PU
Kernel
()
=
default
;
~
BiasAddGradC
PU
Kernel
()
override
=
default
;
void
InitKernel
(
const
CNodePtr
&
kernel_node
)
override
;
bool
Launch
(
const
std
::
vector
<
AddressPtr
>
&
inputs
,
const
std
::
vector
<
AddressPtr
>
&
workspace
,
...
...
@@ -37,8 +36,7 @@ class BiasAddGradCpuKernel : public CPUKernel {
private:
std
::
vector
<
size_t
>
input_shape_
;
};
MS_REG_CPU_KERNEL
(
BiasAddGrad
,
BiasAddGradCpuKernel
);
}
// namespace cpu
}
// namespace device
MS_REG_CPU_KERNEL
(
BiasAddGrad
,
BiasAddGradCPUKernel
);
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_MINDSPORE_CCSRC_
DEVICE_CPU_KERNEL
_BIASADDGRADCPUKERNEL_H_
#endif // MINDSPORE_MINDSPORE_CCSRC_
KERNEL_CPU
_BIASADDGRADCPUKERNEL_H_
mindspore/ccsrc/
device
/cpu/cpu_kernel.cc
→
mindspore/ccsrc/
kernel
/cpu/cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device
/cpu/cpu_kernel.h"
#include "
kernel
/cpu/cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
CPUKernel
::
InitInputOutputSize
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
size_t
input_num
=
AnfAlgo
::
GetInputTensorNum
(
kernel_node
);
...
...
@@ -41,6 +40,5 @@ void CPUKernel::Init(const CNodePtr &kernel_node) {
InitInputOutputSize
(
kernel_node
);
InitKernel
(
kernel_node
);
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device
/cpu/cpu_kernel.h
→
mindspore/ccsrc/
kernel
/cpu/cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_CPU_KERNEL_H_
#include <string>
#include <vector>
...
...
@@ -28,8 +28,7 @@
using
mindspore
::
kernel
::
Address
;
using
mindspore
::
kernel
::
AddressPtr
;
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
const
char
KSIZE
[]
=
"ksize"
;
const
char
STRIDE
[]
=
"stride"
;
const
char
STRIDES
[]
=
"strides"
;
...
...
@@ -70,8 +69,7 @@ class CPUKernel : public kernel::KernelMod {
std
::
vector
<
size_t
>
output_size_list_
;
std
::
vector
<
size_t
>
workspace_size_list_
;
};
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_CPU_KERNEL_H_
mindspore/ccsrc/
device
/cpu/cpu_kernel_factory.cc
→
mindspore/ccsrc/
kernel
/cpu/cpu_kernel_factory.cc
浏览文件 @
e6f36e05
...
...
@@ -14,15 +14,14 @@
* limitations under the License.
*/
#include "
device
/cpu/cpu_kernel_factory.h"
#include "
kernel
/cpu/cpu_kernel_factory.h"
#include <memory>
#include <iostream>
#include <string>
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
CPUKernelFactory
&
CPUKernelFactory
::
Get
()
{
static
CPUKernelFactory
instance
;
return
instance
;
...
...
@@ -45,6 +44,5 @@ std::shared_ptr<CPUKernel> CPUKernelFactory::Create(const std::string &kernel_na
}
return
nullptr
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device
/cpu/cpu_kernel_factory.h
→
mindspore/ccsrc/
kernel
/cpu/cpu_kernel_factory.h
浏览文件 @
e6f36e05
...
...
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_CPU_KERNEL_FACTORY_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_CPU_KERNEL_FACTORY_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_CPU_KERNEL_FACTORY_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_CPU_KERNEL_FACTORY_H_
#include <functional>
#include <map>
...
...
@@ -22,10 +22,9 @@
#include <string>
#include <utility>
#include "common/utils.h"
#include "
device
/cpu/cpu_kernel.h"
#include "
kernel
/cpu/cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
using
CPUKernelCreator
=
std
::
function
<
std
::
shared_ptr
<
CPUKernel
>
()
>
;
class
CPUKernelFactory
{
public:
...
...
@@ -51,8 +50,7 @@ class CPUKernelRegistrar {
#define MS_REG_CPU_KERNEL(KERNEL_NAME, KERNEL_CLASS) \
static const CPUKernelRegistrar g_cpu_kernel_##KERNEL_NAME##_reg(#KERNEL_NAME, \
[]() { return std::make_shared<KERNEL_CLASS>(); });
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_CPU_KERNEL_FACTORY_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_CPU_KERNEL_FACTORY_H_
mindspore/ccsrc/
device/cpu/kernel
/equal_count_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/equal_count_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/equal_count_cpu_kernel.h"
#include "
kernel/cpu
/equal_count_cpu_kernel.h"
#include "device/cpu/cpu_device_address.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
EqualCountCPUKernel
::
InitKernel
(
const
CNodePtr
&
/*kernel_node*/
)
{}
bool
EqualCountCPUKernel
::
Launch
(
const
std
::
vector
<
kernel
::
AddressPtr
>
&
inputs
,
...
...
@@ -43,6 +42,5 @@ bool EqualCountCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
output
[
0
]
=
count
;
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/equal_count_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/equal_count_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_EQUAL_COUNT_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_EQUAL_COUNT_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_EQUAL_COUNT_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_EQUAL_COUNT_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device
/cpu/cpu_kernel.h"
#include "
device
/cpu/cpu_kernel_factory.h"
#include "
kernel
/cpu/cpu_kernel.h"
#include "
kernel
/cpu/cpu_kernel_factory.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
EqualCountCPUKernel
:
public
CPUKernel
{
public:
EqualCountCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class EqualCountCPUKernel : public CPUKernel {
};
MS_REG_CPU_KERNEL
(
EqualCount
,
EqualCountCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_EQUAL_COUNT_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_EQUAL_COUNT_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/conv2d_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/conv2d_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,15 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/conv2d_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/conv2d_cpu_kernel.h"
#include <string>
#include "common/utils.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
Conv2dCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
src_shape
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -88,6 +87,5 @@ bool Conv2dCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
ExecutePrimitive
();
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/conv2d_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/conv2d_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_CONV2D_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_CONV2D_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_CONV2D_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_CONV2D_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
Conv2dCPUKernel
:
public
MKLCPUKernel
{
public:
Conv2dCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class Conv2dCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
Conv2D
,
Conv2dCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_CONV2D_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_CONV2D_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/conv2d_grad_filter_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/conv2d_grad_filter_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,15 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/conv2d_grad_filter_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/conv2d_grad_filter_cpu_kernel.h"
#include <string>
#include "common/utils.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
Conv2dGradFilterCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
src_shape
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
1
);
...
...
@@ -90,6 +89,5 @@ bool Conv2dGradFilterCPUKernel::Launch(const std::vector<kernel::AddressPtr> &in
ExecutePrimitive
();
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/conv2d_grad_filter_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/conv2d_grad_filter_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_CONV2D_GRAD_FILTER_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_CONV2D_GRAD_FILTER_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_CONV2D_GRAD_FILTER_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_CONV2D_GRAD_FILTER_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
Conv2dGradFilterCPUKernel
:
public
MKLCPUKernel
{
public:
Conv2dGradFilterCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class Conv2dGradFilterCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
Conv2DBackpropFilter
,
Conv2dGradFilterCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_CONV2D_GRAD_FILTER_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_CONV2D_GRAD_FILTER_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/conv2d_grad_input_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/conv2d_grad_input_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,15 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/conv2d_grad_input_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/conv2d_grad_input_cpu_kernel.h"
#include <string>
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
#include "common/utils.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
Conv2dGradInputCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
src_shape
=
AnfAlgo
::
GetOutputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -89,6 +88,5 @@ bool Conv2dGradInputCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inp
ExecutePrimitive
();
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/conv2d_grad_input_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/conv2d_grad_input_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_CONV2D_GRAD_INPUT_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_CONV2D_GRAD_INPUT_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_CONV2D_GRAD_INPUT_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_CONV2D_GRAD_INPUT_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
Conv2dGradInputCPUKernel
:
public
MKLCPUKernel
{
public:
Conv2dGradInputCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class Conv2dGradInputCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
Conv2DBackpropInput
,
Conv2dGradInputCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_CONV2D_GRAD_INPUT_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_CONV2D_GRAD_INPUT_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/matmul_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/matmul_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/matmul_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/matmul_cpu_kernel.h"
#include <algorithm>
#include <utility>
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "common/utils.h"
#include "device/cpu/cpu_device_address.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
MatMulCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
src_shape
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -68,6 +67,5 @@ bool MatMulCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
(
void
)
dnnl_sgemm
(
trans_a_
,
trans_b_
,
dim_m_
,
dim_n_
,
dim_k_
,
1.
f
,
input_a
,
lda
,
input_b
,
ldb
,
0.
f
,
output
,
dim_n_
);
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/matmul_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/matmul_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_MATMUL_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_MATMUL_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_MATMUL_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_MATMUL_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
MatMulCPUKernel
:
public
MKLCPUKernel
{
public:
MatMulCPUKernel
()
=
default
;
...
...
@@ -42,8 +41,7 @@ class MatMulCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
MatMul
,
MatMulCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_MATMUL_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_MATMUL_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/mkl_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
#include <vector>
#include <string>
#include <algorithm>
#include "common/utils.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
MKLCPUKernel
::
GetPadding
(
const
CNodePtr
&
kernel_node
,
const
std
::
string
&
pad_mode
,
const
std
::
vector
<
size_t
>
&
src_shape
,
int
kernel_size
,
int
stride
,
std
::
vector
<
int
>
*
padding_l
,
std
::
vector
<
int
>
*
padding_r
)
{
...
...
@@ -99,6 +98,5 @@ void MKLCPUKernel::SetArgumentHandle(int arg_key, void *ptr) {
}
void
MKLCPUKernel
::
ExecutePrimitive
()
{
MKLKernelEngine
::
Get
().
Execute
(
primitive_
,
arguments_
);
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/mkl_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,20 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_MKL_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_MKL_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_MKL_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_MKL_CPU_KERNEL_H_
#include <string>
#include <unordered_map>
#include <memory>
#include <vector>
#include "dnnl.hpp"
#include "
device
/cpu/cpu_kernel.h"
#include "
device
/cpu/cpu_kernel_factory.h"
#include "
kernel
/cpu/cpu_kernel.h"
#include "
kernel
/cpu/cpu_kernel_factory.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
MKLCPUKernel
:
public
CPUKernel
{
public:
MKLCPUKernel
()
=
default
;
...
...
@@ -43,8 +42,7 @@ class MKLCPUKernel : public CPUKernel {
std
::
unordered_map
<
int
,
dnnl
::
memory
>
arguments_
;
std
::
shared_ptr
<
dnnl
::
primitive
>
primitive_
{
nullptr
};
};
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_MKL_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_MKL_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/mkl_kernel_engine.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/mkl_kernel_engine.cc
浏览文件 @
e6f36e05
...
...
@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "utils/log_adapter.h"
#include "dnnl.hpp"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
MKLKernelEngine
::
Execute
(
const
std
::
shared_ptr
<
dnnl
::
primitive
>
&
primitive
,
const
std
::
unordered_map
<
int
,
dnnl
::
memory
>
&
arguments
)
{
MS_EXCEPTION_IF_NULL
(
primitive
);
...
...
@@ -34,6 +33,5 @@ dnnl::memory MKLKernelEngine::CreateMemory(const dnnl::memory::desc &mem_desc, b
return
dnnl
::
memory
(
mem_desc
,
engine_
,
nullptr
);
}
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/mkl_kernel_engine.h
浏览文件 @
e6f36e05
...
...
@@ -23,8 +23,7 @@
#include "common/utils.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
MKLKernelEngine
{
public:
static
MKLKernelEngine
&
Get
()
{
...
...
@@ -46,8 +45,7 @@ class MKLKernelEngine {
dnnl
::
engine
engine_
;
dnnl
::
stream
stream_
;
};
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_MKL_KERNEL_ENGINE_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/mul_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/mul_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/mul_cpu_kernel.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mul_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
#include "common/utils.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
MulCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
src0_shape
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -58,6 +57,5 @@ bool MulCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
ExecutePrimitive
();
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/mul_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/mul_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_MUL_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_MUL_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_MUL_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_MUL_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
MulCPUKernel
:
public
MKLCPUKernel
{
public:
MulCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class MulCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
Mul
,
MulCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_MUL_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_MUL_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/pooling_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/pooling_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/pooling_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/pooling_cpu_kernel.h"
#include <string>
#include <algorithm>
#include "common/utils.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
PoolingCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
src_shape
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -66,6 +65,5 @@ bool PoolingCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
ExecutePrimitive
();
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/pooling_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/pooling_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_POOLING_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_POOLING_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_POOLING_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_POOLING_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
PoolingCPUKernel
:
public
MKLCPUKernel
{
public:
PoolingCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class PoolingCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
MaxPool
,
PoolingCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_POOLING_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_POOLING_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/pooling_grad_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/pooling_grad_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/pooling_grad_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/pooling_grad_cpu_kernel.h"
#include <string>
#include <utility>
#include <algorithm>
#include "common/utils.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
PoolingGradCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
src_shape_
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -121,6 +120,5 @@ bool PoolingGradCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
}
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/pooling_grad_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/pooling_grad_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_POOLING_GRAD_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_POOLING_GRAD_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_POOLING_GRAD_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_POOLING_GRAD_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include <utility>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
PoolingGradCPUKernel
:
public
MKLCPUKernel
{
public:
PoolingGradCPUKernel
()
=
default
;
...
...
@@ -45,8 +44,7 @@ class PoolingGradCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
MaxPoolGrad
,
PoolingGradCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_POOLING_GRAD_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_POOLING_GRAD_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/relu_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/relu_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/relu_cpu_kernel.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/relu_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
#include "common/utils.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
ReluCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
src_shape
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -49,6 +48,5 @@ bool ReluCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
ExecutePrimitive
();
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/relu_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/relu_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_RELU_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_RELU_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_RELU_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_RELU_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
ReluCPUKernel
:
public
MKLCPUKernel
{
public:
ReluCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class ReluCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
ReLU
,
ReluCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_RELU_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_RELU_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/relu_grad_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/relu_grad_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/relu_grad_cpu_kernel.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/relu_grad_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
#include "common/utils.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
ReluGradCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
src_shape
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -66,6 +65,5 @@ bool ReluGradCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
}
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/relu_grad_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/relu_grad_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_RELU_GRAD_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_RELU_GRAD_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_RELU_GRAD_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_RELU_GRAD_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
ReluGradCPUKernel
:
public
MKLCPUKernel
{
public:
ReluGradCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class ReluGradCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
ReluGrad
,
ReluGradCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_RELU_GRAD_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_RELU_GRAD_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/softmax_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/softmax_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/softmax_cpu_kernel.h"
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/softmax_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
#include "common/utils.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
SoftmaxCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
vector
<
size_t
>
src_shape
=
AnfAlgo
::
GetInputDeviceShape
(
kernel_node
,
0
);
...
...
@@ -51,6 +50,5 @@ bool SoftmaxCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
ExecutePrimitive
();
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/softmax_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/softmax_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_SOFTMAX_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_SOFTMAX_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_SOFTMAX_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_SOFTMAX_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
SoftmaxCPUKernel
:
public
MKLCPUKernel
{
public:
SoftmaxCPUKernel
()
=
default
;
...
...
@@ -35,8 +34,7 @@ class SoftmaxCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
Softmax
,
SoftmaxCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_SOFTMAX_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_SOFTMAX_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/mkldnn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.h"
#include <numeric>
#include <functional>
#include <cmath>
#include "
device/cpu/kernel
/mkldnn/mkl_kernel_engine.h"
#include "
kernel/cpu
/mkldnn/mkl_kernel_engine.h"
#include "device/cpu/cpu_device_address.h"
#include "common/utils.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
SparseSoftmaxCrossEntropyWithLogitsCPUKernel
::
InitInputOutputSize
(
const
CNodePtr
&
kernel_node
)
{
CPUKernel
::
InitInputOutputSize
(
kernel_node
);
MS_EXCEPTION_IF_NULL
(
kernel_node
);
...
...
@@ -126,6 +125,5 @@ bool SparseSoftmaxCrossEntropyWithLogitsCPUKernel::Launch(const std::vector<kern
}
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/mkldnn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/mkldnn/sparse_softmax_cross_entropy_with_logits_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_SPARSE_SOFTMAX_CROSS_ENTROPY_WITH_LOGITS_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_SPARSE_SOFTMAX_CROSS_ENTROPY_WITH_LOGITS_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_SPARSE_SOFTMAX_CROSS_ENTROPY_WITH_LOGITS_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_SPARSE_SOFTMAX_CROSS_ENTROPY_WITH_LOGITS_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device/cpu/kernel
/mkldnn/mkl_cpu_kernel.h"
#include "
kernel/cpu
/mkldnn/mkl_cpu_kernel.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
SparseSoftmaxCrossEntropyWithLogitsCPUKernel
:
public
MKLCPUKernel
{
public:
SparseSoftmaxCrossEntropyWithLogitsCPUKernel
()
=
default
;
...
...
@@ -45,8 +44,7 @@ class SparseSoftmaxCrossEntropyWithLogitsCPUKernel : public MKLCPUKernel {
};
MS_REG_CPU_KERNEL
(
SparseSoftmaxCrossEntropyWithLogits
,
SparseSoftmaxCrossEntropyWithLogitsCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_SPARSE_SOFTMAX_CROSS_ENTROPY_WITH_LOGITS_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_SPARSE_SOFTMAX_CROSS_ENTROPY_WITH_LOGITS_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/one_hot_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/one_hot_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/one_hot_cpu_kernel.h"
#include "
kernel/cpu
/one_hot_cpu_kernel.h"
#include "device/cpu/cpu_device_address.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
OneHotCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
auto
output_shape
=
AnfAlgo
::
GetOutputInferShape
(
kernel_node
,
0
);
...
...
@@ -69,6 +68,5 @@ bool OneHotCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/one_hot_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/one_hot_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_ONE_HOT_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_ONE_HOT_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_ONE_HOT_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_ONE_HOT_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device
/cpu/cpu_kernel.h"
#include "
device
/cpu/cpu_kernel_factory.h"
#include "
kernel
/cpu/cpu_kernel.h"
#include "
kernel
/cpu/cpu_kernel_factory.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
OneHotCPUKernel
:
public
CPUKernel
{
public:
OneHotCPUKernel
()
=
default
;
...
...
@@ -40,8 +39,7 @@ class OneHotCPUKernel : public CPUKernel {
};
MS_REG_CPU_KERNEL
(
OneHot
,
OneHotCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_ONE_HOT_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_ONE_HOT_CPU_KERNEL_H_
mindspore/ccsrc/
device/cpu/kernel
/reshape_cpu_kernel.cc
→
mindspore/ccsrc/
kernel/cpu
/reshape_cpu_kernel.cc
浏览文件 @
e6f36e05
...
...
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "
device/cpu/kernel
/reshape_cpu_kernel.h"
#include "
kernel/cpu
/reshape_cpu_kernel.h"
#include "device/cpu/cpu_device_address.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
void
ReshapeCPUKernel
::
InitKernel
(
const
CNodePtr
&
kernel_node
)
{
MS_EXCEPTION_IF_NULL
(
kernel_node
);
}
bool
ReshapeCPUKernel
::
Launch
(
const
std
::
vector
<
kernel
::
AddressPtr
>
&
inputs
,
...
...
@@ -43,6 +42,5 @@ bool ReshapeCPUKernel::Launch(const std::vector<kernel::AddressPtr> &inputs,
}
return
true
;
}
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
mindspore/ccsrc/
device/cpu/kernel
/reshape_cpu_kernel.h
→
mindspore/ccsrc/
kernel/cpu
/reshape_cpu_kernel.h
浏览文件 @
e6f36e05
...
...
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_
DEVICE
_CPU_RESHAPE_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
DEVICE
_CPU_RESHAPE_CPU_KERNEL_H_
#ifndef MINDSPORE_CCSRC_
KERNEL
_CPU_RESHAPE_CPU_KERNEL_H_
#define MINDSPORE_CCSRC_
KERNEL
_CPU_RESHAPE_CPU_KERNEL_H_
#include <vector>
#include <memory>
#include "
device
/cpu/cpu_kernel.h"
#include "
device
/cpu/cpu_kernel_factory.h"
#include "
kernel
/cpu/cpu_kernel.h"
#include "
kernel
/cpu/cpu_kernel_factory.h"
namespace
mindspore
{
namespace
device
{
namespace
cpu
{
namespace
kernel
{
class
ReshapeCPUKernel
:
public
CPUKernel
{
public:
ReshapeCPUKernel
()
=
default
;
...
...
@@ -37,8 +36,7 @@ class ReshapeCPUKernel : public CPUKernel {
MS_REG_CPU_KERNEL
(
Reshape
,
ReshapeCPUKernel
);
MS_REG_CPU_KERNEL
(
Flatten
,
ReshapeCPUKernel
);
MS_REG_CPU_KERNEL
(
ExpandDims
,
ReshapeCPUKernel
);
}
// namespace cpu
}
// namespace device
}
// namespace kernel
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_
DEVICE
_CPU_RESHAPE_CPU_KERNEL_H_
#endif // MINDSPORE_CCSRC_
KERNEL
_CPU_RESHAPE_CPU_KERNEL_H_
mindspore/ccsrc/session/CMakeLists.txt
浏览文件 @
e6f36e05
...
...
@@ -12,6 +12,13 @@ if (ENABLE_GPU)
list
(
APPEND _SESSION_SRC_LIST
${
_GPU_SRC_LIST
}
)
endif
()
if
(
ENABLE_CPU
)
file
(
GLOB_RECURSE _CPU_SRC_LIST RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
"cpu_session.cc"
)
list
(
APPEND _SESSION_SRC_LIST
${
_CPU_SRC_LIST
}
)
endif
()
if
(
ENABLE_D
)
file
(
GLOB_RECURSE _D_SRC_LIST RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
"ascend_session.cc"
...
...
mindspore/ccsrc/
device/cpu
/cpu_session.cc
→
mindspore/ccsrc/
session
/cpu_session.cc
浏览文件 @
e6f36e05
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "
device/cpu
/cpu_session.h"
#include "
session
/cpu_session.h"
#include <algorithm>
#include "ir/meta_tensor.h"
#include "ir/anf.h"
...
...
@@ -23,7 +23,7 @@
#include "session/anf_runtime_algorithm.h"
#include "device/kernel_runtime.h"
#include "predict/predict.h"
#include "
device
/cpu/cpu_kernel_factory.h"
#include "
kernel
/cpu/cpu_kernel_factory.h"
namespace
mindspore
{
namespace
session
{
...
...
@@ -110,7 +110,7 @@ void CPUSession::BuildKernel(const KernelGraph *kernel_graph) {
MS_EXCEPTION_IF_NULL
(
kernel_node
);
std
::
string
kernel_name
=
AnfAlgo
::
GetCNodeName
(
kernel_node
);
MS_LOG
(
INFO
)
<<
"Cpu building operator["
<<
kernel_name
<<
"]."
;
std
::
shared_ptr
<
device
::
cpu
::
CPUKernel
>
cpu_kernel
=
device
::
cpu
::
CPUKernelFactory
::
Get
().
Create
(
kernel_name
);
std
::
shared_ptr
<
kernel
::
CPUKernel
>
cpu_kernel
=
kernel
::
CPUKernelFactory
::
Get
().
Create
(
kernel_name
);
if
(
cpu_kernel
==
nullptr
)
{
MS_LOG
(
EXCEPTION
)
<<
"Operator["
<<
kernel_name
<<
"] is not support."
;
}
...
...
mindspore/ccsrc/
device/cpu
/cpu_session.h
→
mindspore/ccsrc/
session
/cpu_session.h
浏览文件 @
e6f36e05
文件已移动
mindspore/ccsrc/session/session_factory.h
浏览文件 @
e6f36e05
...
...
@@ -22,7 +22,6 @@
#include <string>
#include <utility>
#include "common/utils.h"
#include "device/cpu/cpu_kernel.h"
#include "session/session_basic.h"
namespace
mindspore
{
namespace
session
{
...
...
tests/ut/cpp/pre_activate/ascend/enhancer/insert_memcpy_async_for_getnext.cc
浏览文件 @
e6f36e05
...
...
@@ -16,6 +16,7 @@
#include "common/backend_common_test.h"
#include "common/py_func_graph_fetcher.h"
#include "session/ascend_session.h"
#include "session/anf_runtime_algorithm.h"
#include "pipeline/resource.h"
#include "operator/ops.h"
#include "ir/manager.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录