Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
0597f4de
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0597f4de
编写于
9月 14, 2017
作者:
L
Luo Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
auto generate USE_OP() in pybind.cc
上级
0f42e564
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
35 addition
and
48 deletion
+35
-48
.gitignore
.gitignore
+1
-0
cmake/cpplint.cmake
cmake/cpplint.cmake
+2
-2
paddle/operators/CMakeLists.txt
paddle/operators/CMakeLists.txt
+30
-1
paddle/operators/concat_op.cu
paddle/operators/concat_op.cu
+0
-19
paddle/operators/onehot_cross_entropy_op.cc
paddle/operators/onehot_cross_entropy_op.cc
+1
-1
paddle/operators/onehot_cross_entropy_op.cu
paddle/operators/onehot_cross_entropy_op.cu
+0
-0
paddle/operators/onehot_cross_entropy_op.h
paddle/operators/onehot_cross_entropy_op.h
+0
-0
paddle/pybind/pybind.cc
paddle/pybind/pybind.cc
+1
-25
未找到文件。
.gitignore
浏览文件 @
0597f4de
...
@@ -22,6 +22,7 @@ cmake-build-*
...
@@ -22,6 +22,7 @@ cmake-build-*
# generated while compiling
# generated while compiling
python/paddle/v2/framework/core.so
python/paddle/v2/framework/core.so
paddle/pybind/pybind.h
CMakeFiles
CMakeFiles
cmake_install.cmake
cmake_install.cmake
paddle/.timestamp
paddle/.timestamp
...
...
cmake/cpplint.cmake
浏览文件 @
0597f4de
...
@@ -26,9 +26,9 @@ set(IGNORE_PATTERN
...
@@ -26,9 +26,9 @@ set(IGNORE_PATTERN
.*ImportanceSampler.*
.*ImportanceSampler.*
.*cblas\\.h.*
.*cblas\\.h.*
.*\\.pb\\.txt
.*\\.pb\\.txt
.*LtrDataProvider.*
.*MultiDataProvider.*
.*MultiDataProvider.*
.*pb.*
)
.*pb.*
.*pybind.h
)
# add_style_check_target
# add_style_check_target
#
#
...
...
paddle/operators/CMakeLists.txt
浏览文件 @
0597f4de
file
(
GLOB GENERAL_OPS RELATIVE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"*_op.cc"
)
file
(
GLOB GENERAL_OPS RELATIVE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"*_op.cc"
)
string
(
REPLACE
".cc"
""
GENERAL_OPS
"
${
GENERAL_OPS
}
"
)
string
(
REPLACE
".cc"
""
GENERAL_OPS
"
${
GENERAL_OPS
}
"
)
set
(
pybind_file
${
PADDLE_SOURCE_DIR
}
/paddle/pybind/pybind.h
)
file
(
WRITE
${
pybind_file
}
"// Generated by the paddle/operator/CMakeLists.txt. DO NOT EDIT!
\n\n
"
)
function
(
op_library TARGET
)
function
(
op_library TARGET
)
# op_library is a function to create op library. The interface is same as
# op_library is a function to create op library. The interface is same as
# cc_library. But it handle split GPU/CPU code and link some common library
# cc_library. But it handle split GPU/CPU code and link some common library
...
@@ -11,6 +13,7 @@ function(op_library TARGET)
...
@@ -11,6 +13,7 @@ function(op_library TARGET)
set
(
options
""
)
set
(
options
""
)
set
(
oneValueArgs
""
)
set
(
oneValueArgs
""
)
set
(
multiValueArgs SRCS DEPS
)
set
(
multiValueArgs SRCS DEPS
)
set
(
pybind_flag 0
)
cmake_parse_arguments
(
op_library
"
${
options
}
"
"
${
oneValueArgs
}
"
cmake_parse_arguments
(
op_library
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
"
${
multiValueArgs
}
"
${
ARGN
}
)
...
@@ -46,6 +49,32 @@ function(op_library TARGET)
...
@@ -46,6 +49,32 @@ function(op_library TARGET)
cc_library
(
${
TARGET
}
SRCS
${
cc_srcs
}
DEPS
${
op_library_DEPS
}
cc_library
(
${
TARGET
}
SRCS
${
cc_srcs
}
DEPS
${
op_library_DEPS
}
${
op_common_deps
}
)
${
op_common_deps
}
)
endif
()
endif
()
# net_op doesn't need pybind
if
(
"
${
TARGET
}
"
STREQUAL
"net_op"
)
set
(
pybind_file 1
)
endif
()
# pybind USE_NO_KERNEL_OP
file
(
READ
${
TARGET
}
.cc TARGET_CONTENT
)
string
(
REGEX MATCH
"OperatorWithKernel"
regex_result
"
${
TARGET_CONTENT
}
"
)
string
(
REPLACE
"_op"
""
TARGET
"
${
TARGET
}
"
)
if
(
${
pybind_flag
}
EQUAL 0 AND regex_result STREQUAL
""
)
file
(
APPEND
${
pybind_file
}
"USE_NO_KERNEL_OP(
${
TARGET
}
);
\n
"
)
set
(
pybind_flag 1
)
endif
()
# pybind USE_CPU_ONLY_OP
list
(
LENGTH cu_srcs cu_srcs_len
)
if
(
${
pybind_flag
}
EQUAL 0 AND
${
cu_srcs_len
}
EQUAL 0
)
file
(
APPEND
${
pybind_file
}
"USE_CPU_ONLY_OP(
${
TARGET
}
);
\n
"
)
set
(
pybind_flag 1
)
endif
()
# pybind USE_OP
if
(
${
pybind_flag
}
EQUAL 0
)
file
(
APPEND
${
pybind_file
}
"USE_OP(
${
TARGET
}
);
\n
"
)
endif
()
endfunction
()
endfunction
()
add_subdirectory
(
math
)
add_subdirectory
(
math
)
...
@@ -60,7 +89,7 @@ op_library(identity_op DEPS scale_op)
...
@@ -60,7 +89,7 @@ op_library(identity_op DEPS scale_op)
op_library
(
minus_op DEPS scale_op
)
op_library
(
minus_op DEPS scale_op
)
op_library
(
mul_op DEPS math_function
)
op_library
(
mul_op DEPS math_function
)
op_library
(
recurrent_op SRCS recurrent_op.cc rnn/recurrent_op_utils.cc
op_library
(
recurrent_op SRCS recurrent_op.cc rnn/recurrent_op_utils.cc
DEPS framework_proto tensor
operator
net_op
)
DEPS framework_proto tensor net_op
)
op_library
(
scale_op DEPS net_op
)
op_library
(
scale_op DEPS net_op
)
list
(
REMOVE_ITEM GENERAL_OPS
${
DEPS_OPS
}
)
list
(
REMOVE_ITEM GENERAL_OPS
${
DEPS_OPS
}
)
...
...
paddle/operators/concat_op.cu
已删除
100644 → 0
浏览文件 @
0f42e564
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
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. */
#define EIGEN_USE_GPU
#include "paddle/operators/concat_op.h"
namespace
ops
=
paddle
::
operators
;
// TODO(Yancey1989) Add GPU kernel
paddle/operators/cross_entropy_op.cc
→
paddle/operators/
onehot_
cross_entropy_op.cc
浏览文件 @
0597f4de
...
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#include "paddle/operators/cross_entropy_op.h"
#include "paddle/operators/
onehot_
cross_entropy_op.h"
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
...
...
paddle/operators/cross_entropy_op.cu
→
paddle/operators/
onehot_
cross_entropy_op.cu
浏览文件 @
0597f4de
文件已移动
paddle/operators/cross_entropy_op.h
→
paddle/operators/
onehot_
cross_entropy_op.h
浏览文件 @
0597f4de
文件已移动
paddle/pybind/pybind.cc
浏览文件 @
0597f4de
...
@@ -23,6 +23,7 @@ limitations under the License. */
...
@@ -23,6 +23,7 @@ limitations under the License. */
#include "paddle/operators/recurrent_op.h"
#include "paddle/operators/recurrent_op.h"
#include "paddle/platform/enforce.h"
#include "paddle/platform/enforce.h"
#include "paddle/platform/place.h"
#include "paddle/platform/place.h"
#include "paddle/pybind/pybind.h"
#include "paddle/pybind/tensor_py.h"
#include "paddle/pybind/tensor_py.h"
#include "paddle/string/to_string.h"
#include "paddle/string/to_string.h"
#include "pybind11/numpy.h"
#include "pybind11/numpy.h"
...
@@ -31,31 +32,6 @@ limitations under the License. */
...
@@ -31,31 +32,6 @@ limitations under the License. */
namespace
py
=
pybind11
;
namespace
py
=
pybind11
;
USE_OP
(
add
);
USE_OP
(
onehot_cross_entropy
);
USE_OP
(
sgd
);
USE_OP
(
mul
);
USE_OP
(
mean
);
USE_OP
(
sigmoid
);
USE_OP
(
softmax
);
USE_OP
(
rowwise_add
);
USE_OP
(
fill_zeros_like
);
USE_NO_KERNEL_OP
(
recurrent
);
USE_OP
(
gaussian_random
);
USE_OP
(
uniform_random
);
USE_OP
(
lookup_table
);
USE_OP
(
scale
);
USE_NO_KERNEL_OP
(
identity
);
USE_OP
(
minus
);
USE_OP
(
cos_sim
);
USE_CPU_ONLY_OP
(
gather
);
USE_CPU_ONLY_OP
(
scatter
);
USE_CPU_ONLY_OP
(
concat
);
USE_OP
(
top_k
);
USE_OP
(
squared_l2_distance
);
USE_OP
(
sum
);
USE_OP
(
reshape
);
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录