Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
61fe139f
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
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看板
提交
61fe139f
编写于
4月 03, 2019
作者:
M
minqiyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish code
上级
e377d759
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
10 deletion
+9
-10
paddle/fluid/operators/softmax_with_cross_entropy_op.cu
paddle/fluid/operators/softmax_with_cross_entropy_op.cu
+1
-1
python/paddle/fluid/dygraph/nn.py
python/paddle/fluid/dygraph/nn.py
+6
-6
python/paddle/fluid/tests/unittests/test_layers.py
python/paddle/fluid/tests/unittests/test_layers.py
+2
-3
未找到文件。
paddle/fluid/operators/softmax_with_cross_entropy_op.cu
浏览文件 @
61fe139f
...
@@ -404,7 +404,7 @@ class SoftmaxWithCrossEntropyCUDAKernel : public framework::OpKernel<T> {
...
@@ -404,7 +404,7 @@ class SoftmaxWithCrossEntropyCUDAKernel : public framework::OpKernel<T> {
int
batch_size
=
logits
->
dims
()[
0
];
int
batch_size
=
logits
->
dims
()[
0
];
int
feature_size
=
logits
->
dims
()[
1
];
int
feature_size
=
logits
->
dims
()[
1
];
auto
*
logits_data
=
logits
->
data
<
T
>
();
auto
*
logits_data
=
logits
->
data
<
T
>
();
auto
*
labels_data
=
labels
->
data
<
int64_t
>
();
auto
*
labels_data
=
labels
->
data
<
T
>
();
SoftmaxWithCrossEntropyFusedKernel
(
SoftmaxWithCrossEntropyFusedKernel
(
logits_data
,
labels_data
,
softmax_data
,
loss_data
,
batch_size
,
logits_data
,
labels_data
,
softmax_data
,
loss_data
,
batch_size
,
feature_size
,
context
.
cuda_device_context
().
stream
());
feature_size
,
context
.
cuda_device_context
().
stream
());
...
...
python/paddle/fluid/dygraph/nn.py
浏览文件 @
61fe139f
...
@@ -563,7 +563,7 @@ class LayerNorm(layers.Layer):
...
@@ -563,7 +563,7 @@ class LayerNorm(layers.Layer):
>>> x = fluid.layers.layer_norm(input=data, begin_norm_axis=1)
>>> x = fluid.layers.layer_norm(input=data, begin_norm_axis=1)
"""
"""
super
(
LayerNorm
,
self
).
__init__
(
name_scope
,
dtype
)
super
(
LayerNorm
,
self
).
__init__
(
name_scope
)
self
.
_scale
=
scale
self
.
_scale
=
scale
self
.
_shift
=
shift
self
.
_shift
=
shift
self
.
_begin_norm_axis
=
begin_norm_axis
self
.
_begin_norm_axis
=
begin_norm_axis
...
@@ -840,7 +840,7 @@ class NCE(layers.Layer):
...
@@ -840,7 +840,7 @@ class NCE(layers.Layer):
custom_dist
=
None
,
custom_dist
=
None
,
seed
=
0
,
seed
=
0
,
is_sparse
=
False
):
is_sparse
=
False
):
super
(
NCE
,
self
).
__init__
(
name_scope
,
dtype
)
super
(
NCE
,
self
).
__init__
(
name_scope
)
self
.
_param_attr
=
param_attr
self
.
_param_attr
=
param_attr
self
.
_bias_attr
=
bias_attr
self
.
_bias_attr
=
bias_attr
self
.
_num_total_classes
=
num_total_classes
self
.
_num_total_classes
=
num_total_classes
...
@@ -1013,7 +1013,7 @@ class PRelu(layers.Layer):
...
@@ -1013,7 +1013,7 @@ class PRelu(layers.Layer):
def
__init__
(
self
,
name_scope
,
mode
,
param_attr
=
None
):
def
__init__
(
self
,
name_scope
,
mode
,
param_attr
=
None
):
super
(
PRelu
,
self
).
__init__
(
name_scope
,
dtype
)
super
(
PRelu
,
self
).
__init__
(
name_scope
)
self
.
_mode
=
mode
self
.
_mode
=
mode
self
.
_param_attr
=
param_attr
self
.
_param_attr
=
param_attr
if
self
.
_mode
not
in
[
'all'
,
'channel'
,
'element'
]:
if
self
.
_mode
not
in
[
'all'
,
'channel'
,
'element'
]:
...
@@ -1090,7 +1090,7 @@ class BilinearTensorProduct(layers.Layer):
...
@@ -1090,7 +1090,7 @@ class BilinearTensorProduct(layers.Layer):
act
=
None
,
act
=
None
,
param_attr
=
None
,
param_attr
=
None
,
bias_attr
=
None
):
bias_attr
=
None
):
super
(
BilinearTensorProduct
,
self
).
__init__
(
name_scope
,
dtype
)
super
(
BilinearTensorProduct
,
self
).
__init__
(
name_scope
)
self
.
_param_attr
=
param_attr
self
.
_param_attr
=
param_attr
self
.
_bias_attr
=
bias_attr
self
.
_bias_attr
=
bias_attr
self
.
_act
=
act
self
.
_act
=
act
...
@@ -1260,7 +1260,7 @@ class Conv2DTranspose(layers.Layer):
...
@@ -1260,7 +1260,7 @@ class Conv2DTranspose(layers.Layer):
bias_attr
=
None
,
bias_attr
=
None
,
use_cudnn
=
True
,
use_cudnn
=
True
,
act
=
None
):
act
=
None
):
super
(
Conv2DTranspose
,
self
).
__init__
(
name_scope
,
dtype
)
super
(
Conv2DTranspose
,
self
).
__init__
(
name_scope
)
assert
param_attr
is
not
False
,
"param_attr should not be False in conv2d_transpose."
assert
param_attr
is
not
False
,
"param_attr should not be False in conv2d_transpose."
self
.
_param_attr
=
param_attr
self
.
_param_attr
=
param_attr
self
.
_bias_attr
=
bias_attr
self
.
_bias_attr
=
bias_attr
...
@@ -1388,7 +1388,7 @@ class SequenceConv(layers.Layer):
...
@@ -1388,7 +1388,7 @@ class SequenceConv(layers.Layer):
bias_attr
=
None
,
bias_attr
=
None
,
param_attr
=
None
,
param_attr
=
None
,
act
=
None
):
act
=
None
):
super
(
SequenceConv
,
self
).
__init__
(
name_scope
,
dtype
)
super
(
SequenceConv
,
self
).
__init__
(
name_scope
)
self
.
_num_filters
=
num_filters
self
.
_num_filters
=
num_filters
self
.
_filter_size
=
filter_size
self
.
_filter_size
=
filter_size
self
.
_filter_stride
=
filter_stride
self
.
_filter_stride
=
filter_stride
...
...
python/paddle/fluid/tests/unittests/test_layers.py
浏览文件 @
61fe139f
...
@@ -672,9 +672,8 @@ class TestBook(LayerTest):
...
@@ -672,9 +672,8 @@ class TestBook(LayerTest):
def
make_sampled_softmax_with_cross_entropy
(
self
):
def
make_sampled_softmax_with_cross_entropy
(
self
):
with
program_guard
(
fluid
.
default_main_program
(),
with
program_guard
(
fluid
.
default_main_program
(),
fluid
.
default_startup_program
()):
fluid
.
default_startup_program
()):
logits
=
self
.
_get_data
(
name
=
'Logits'
,
shape
=
[
256
],
dtype
=
'float64'
)
logits
=
self
.
_get_data
(
name
=
'Logits'
,
shape
=
[
256
],
dtype
=
'float32'
)
print
(
logits
.
dtype
)
label
=
self
.
_get_data
(
name
=
'Label'
,
shape
=
[
1
],
dtype
=
'int32'
)
label
=
self
.
_get_data
(
name
=
'Label'
,
shape
=
[
1
],
dtype
=
'int64'
)
num_samples
=
25
num_samples
=
25
output
=
layers
.
sampled_softmax_with_cross_entropy
(
logits
,
label
,
output
=
layers
.
sampled_softmax_with_cross_entropy
(
logits
,
label
,
num_samples
)
num_samples
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录