Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
e9082bb7
P
Paddle
项目概览
PaddlePaddle
/
Paddle
接近 2 年 前同步成功
通知
2323
Star
20933
Fork
5424
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e9082bb7
编写于
11月 13, 2017
作者:
D
dangqingqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resume unit testing.
上级
884ce5d5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
33 addition
and
37 deletion
+33
-37
paddle/operators/cross_entropy_op.cu
paddle/operators/cross_entropy_op.cu
+0
-2
paddle/operators/math/math_function.cu
paddle/operators/math/math_function.cu
+3
-3
paddle/operators/sequence_conv_op.h
paddle/operators/sequence_conv_op.h
+0
-2
python/paddle/v2/framework/tests/test_lstm_op.py
python/paddle/v2/framework/tests/test_lstm_op.py
+1
-2
python/paddle/v2/framework/tests/test_seq_conv.py
python/paddle/v2/framework/tests/test_seq_conv.py
+29
-28
未找到文件。
paddle/operators/cross_entropy_op.cu
浏览文件 @
e9082bb7
...
@@ -23,8 +23,6 @@ template <typename T>
...
@@ -23,8 +23,6 @@ template <typename T>
__global__
void
CrossEntropyGradientKernel
(
T
*
dX
,
const
T
*
dY
,
const
T
*
X
,
__global__
void
CrossEntropyGradientKernel
(
T
*
dX
,
const
T
*
dY
,
const
T
*
X
,
const
int64_t
*
label
,
const
int
N
,
const
int64_t
*
label
,
const
int
N
,
const
int
D
)
{
const
int
D
)
{
// TOOD(qingqing) define CUDA_1D_KERNEL_LOOP macro in a common file.
// CUDA_1D_KERNEL_LOOP(i, N) {
for
(
int
i
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
i
<
N
;
for
(
int
i
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
i
<
N
;
i
+=
blockDim
.
x
*
gridDim
.
x
)
{
i
+=
blockDim
.
x
*
gridDim
.
x
)
{
int
idx
=
i
*
D
+
label
[
i
];
int
idx
=
i
*
D
+
label
[
i
];
...
...
paddle/operators/math/math_function.cu
浏览文件 @
e9082bb7
...
@@ -240,7 +240,7 @@ void axpy<platform::GPUPlace, float>(const platform::DeviceContext& context,
...
@@ -240,7 +240,7 @@ void axpy<platform::GPUPlace, float>(const platform::DeviceContext& context,
PADDLE_ENFORCE
(
platform
::
dynload
::
cublasSaxpy
(
PADDLE_ENFORCE
(
platform
::
dynload
::
cublasSaxpy
(
reinterpret_cast
<
const
platform
::
CUDADeviceContext
&>
(
context
)
reinterpret_cast
<
const
platform
::
CUDADeviceContext
&>
(
context
)
.
cublas_handle
(),
.
cublas_handle
(),
n
,
alpha
,
x
,
1
,
y
,
1
));
n
,
&
alpha
,
x
,
1
,
y
,
1
));
}
}
template
<
>
template
<
>
...
@@ -250,7 +250,7 @@ void axpy<platform::GPUPlace, double>(const platform::DeviceContext& context,
...
@@ -250,7 +250,7 @@ void axpy<platform::GPUPlace, double>(const platform::DeviceContext& context,
PADDLE_ENFORCE
(
platform
::
dynload
::
cublasDaxpy
(
PADDLE_ENFORCE
(
platform
::
dynload
::
cublasDaxpy
(
reinterpret_cast
<
const
platform
::
CUDADeviceContext
&>
(
context
)
reinterpret_cast
<
const
platform
::
CUDADeviceContext
&>
(
context
)
.
cublas_handle
(),
.
cublas_handle
(),
n
,
alpha
,
x
,
1
,
y
,
1
));
n
,
&
alpha
,
x
,
1
,
y
,
1
));
}
}
template
struct
SetConstant
<
platform
::
GPUPlace
,
float
>;
template
struct
SetConstant
<
platform
::
GPUPlace
,
float
>;
...
@@ -270,7 +270,7 @@ DEFINE_GPU_TRANS(6);
...
@@ -270,7 +270,7 @@ DEFINE_GPU_TRANS(6);
struct
TensorSetConstantGPU
{
struct
TensorSetConstantGPU
{
TensorSetConstantGPU
(
const
platform
::
DeviceContext
&
context
,
TensorSetConstantGPU
(
const
platform
::
DeviceContext
&
context
,
framework
::
Tensor
*
tensor
,
float
value
)
framework
::
Tensor
*
tensor
,
float
value
)
:
context_
(
context
),
tensor_
(
tensor
),
value_
(
value
)
{}
:
context_
(
context
),
tensor_
(
tensor
),
value_
(
value
)
{}
template
<
typename
T
>
template
<
typename
T
>
...
...
paddle/operators/sequence_conv_op.h
浏览文件 @
e9082bb7
...
@@ -65,10 +65,8 @@ class SequenceConvKernel : public framework::OpKernel<T> {
...
@@ -65,10 +65,8 @@ class SequenceConvKernel : public framework::OpKernel<T> {
padding_trainable
,
context_start
,
context_length
,
padding_trainable
,
context_start
,
context_length
,
context_stride
,
up_pad
,
down_pad
);
context_stride
,
up_pad
,
down_pad
);
context
.
device_context
().
Finish
();
math
::
matmul
<
Place
,
T
>
(
context
.
device_context
(),
col
,
false
,
filter
,
false
,
math
::
matmul
<
Place
,
T
>
(
context
.
device_context
(),
col
,
false
,
filter
,
false
,
static_cast
<
T
>
(
1.0
),
out
,
static_cast
<
T
>
(
0.0
));
static_cast
<
T
>
(
1.0
),
out
,
static_cast
<
T
>
(
0.0
));
context
.
device_context
().
Finish
();
}
}
};
};
...
...
python/paddle/v2/framework/tests/test_lstm_op.py
浏览文件 @
e9082bb7
...
@@ -180,7 +180,6 @@ class TestLstmOp(OpTest):
...
@@ -180,7 +180,6 @@ class TestLstmOp(OpTest):
[
'Input'
,
'Weight'
,
'Bias'
],
[
'Hidden'
],
max_relative_error
=
5e-4
)
[
'Input'
,
'Weight'
,
'Bias'
],
[
'Hidden'
],
max_relative_error
=
5e-4
)
"""
class
TestLstmOpHasInitial
(
TestLstmOp
):
class
TestLstmOpHasInitial
(
TestLstmOp
):
def
set_argument
(
self
):
def
set_argument
(
self
):
self
.
lod
=
[[
0
,
2
,
5
,
7
]]
self
.
lod
=
[[
0
,
2
,
5
,
7
]]
...
@@ -281,7 +280,7 @@ class TestLstmOpNotUsePeepholes(TestLstmOp):
...
@@ -281,7 +280,7 @@ class TestLstmOpNotUsePeepholes(TestLstmOp):
self
.
has_initial_state
=
False
self
.
has_initial_state
=
False
self
.
is_reverse
=
True
self
.
is_reverse
=
True
self
.
use_peepholes
=
False
self
.
use_peepholes
=
False
"""
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
python/paddle/v2/framework/tests/test_seq_conv.py
浏览文件 @
e9082bb7
...
@@ -122,7 +122,7 @@ class TestSeqProject(OpTest):
...
@@ -122,7 +122,7 @@ class TestSeqProject(OpTest):
max_relative_error
=
0.05
,
max_relative_error
=
0.05
,
no_grad_set
=
set
([
'X'
,
'Filter'
]))
no_grad_set
=
set
([
'X'
,
'Filter'
]))
def
not_
test_check_grad_Filter
(
self
):
def
test_check_grad_Filter
(
self
):
self
.
check_grad
(
self
.
check_grad
(
[
'Filter'
],
[
'Filter'
],
'Out'
,
'Out'
,
...
@@ -165,33 +165,34 @@ class TestSeqProject(OpTest):
...
@@ -165,33 +165,34 @@ class TestSeqProject(OpTest):
self
.
output_represention
=
8
# output feature size
self
.
output_represention
=
8
# output feature size
#class TestSeqProjectCase1(TestSeqProject):
class
TestSeqProjectCase1
(
TestSeqProject
):
# def init_test_case(self):
def
init_test_case
(
self
):
# self.input_row = 11
self
.
input_row
=
11
# self.context_start = -1
self
.
context_start
=
-
1
# self.context_length = 3
self
.
context_length
=
3
# self.padding_trainable = True
self
.
padding_trainable
=
True
# self.context_stride = 1
self
.
context_stride
=
1
#
# self.input_size = [self.input_row, 23]
self
.
input_size
=
[
self
.
input_row
,
23
]
# self.lod = [[0, 4, 5, 8, self.input_row]]
self
.
lod
=
[[
0
,
4
,
5
,
8
,
self
.
input_row
]]
# self.output_represention = 8 # output feature size
self
.
output_represention
=
8
# output feature size
#
#
#class TestSeqProjectCase2(TestSeqProject):
class
TestSeqProjectCase2
(
TestSeqProject
):
# def init_test_case(self):
def
init_test_case
(
self
):
# self.input_row = 25
self
.
input_row
=
25
# self.context_start = 2
self
.
context_start
=
2
# self.context_length = 3
self
.
context_length
=
3
# self.padding_trainable = True
self
.
padding_trainable
=
True
# self.context_stride = 1
self
.
context_stride
=
1
#
# self.input_size = [self.input_row, 23]
self
.
input_size
=
[
self
.
input_row
,
23
]
# idx = range(self.input_size[0])
idx
=
range
(
self
.
input_size
[
0
])
# del idx[0]
del
idx
[
0
]
# self.lod = [[0] + np.sort(random.sample(idx, 8)).tolist() +
self
.
lod
=
[[
0
]
+
np
.
sort
(
random
.
sample
(
idx
,
8
)).
tolist
()
+
# [self.input_size[0]]]
[
self
.
input_size
[
0
]]]
# self.output_represention = 8 # output feature size
self
.
output_represention
=
8
# output feature size
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录