Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
413e3eb5
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看板
提交
413e3eb5
编写于
9月 01, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
9月 01, 2020
浏览文件
操作
浏览文件
下载
差异文件
!5622 fix nccl broadcast
Merge pull request !5622 from baihuawei/0901
上级
f42b3bbf
572a7c47
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
12 deletion
+18
-12
mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/lstm_cpu_kernel.cc
...src/backend/kernel_compiler/cpu/mkldnn/lstm_cpu_kernel.cc
+3
-3
mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/lstm_grad_cpu_kernel.cc
...ackend/kernel_compiler/cpu/mkldnn/lstm_grad_cpu_kernel.cc
+3
-3
mindspore/ccsrc/backend/kernel_compiler/gpu/nccl/nccl_gpu_kernel.h
.../ccsrc/backend/kernel_compiler/gpu/nccl/nccl_gpu_kernel.h
+7
-3
mindspore/nn/probability/distribution/categorical.py
mindspore/nn/probability/distribution/categorical.py
+4
-2
mindspore/ops/operations/random_ops.py
mindspore/ops/operations/random_ops.py
+1
-1
未找到文件。
mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/lstm_cpu_kernel.cc
浏览文件 @
413e3eb5
...
...
@@ -86,6 +86,9 @@ void LstmCPUKernel::CheckParam(const CNodePtr &kernel_node) {
num_directions_
=
2
;
}
const
int
gate_size
=
4
*
hidden_size_
;
if
(
num_layers_
<=
0
)
{
MS_LOG
(
EXCEPTION
)
<<
"layers must be greater than zero!"
;
}
for
(
int
i
=
0
;
i
<
num_layers_
;
++
i
)
{
weight_size_
+=
gate_size
*
(
i
==
0
?
input_size_
:
hidden_size_
*
num_directions_
);
weight_h_size_
+=
gate_size
*
hidden_size_
;
...
...
@@ -95,9 +98,6 @@ void LstmCPUKernel::CheckParam(const CNodePtr &kernel_node) {
if
(
num_directions_
*
num_layers_
!=
SizeToInt
(
src_h_shape
[
0
]))
{
MS_LOG
(
EXCEPTION
)
<<
"error iteration shape!"
;
}
if
(
num_layers_
<=
0
)
{
MS_LOG
(
EXCEPTION
)
<<
"layers must be greater than zero!"
;
}
if
(
src_shape
.
size
()
!=
3
||
src_h_shape
.
size
()
!=
3
||
src_c_shape
.
size
()
!=
3
)
{
MS_LOG
(
EXCEPTION
)
<<
"lstm only support 3-D input!"
;
}
...
...
mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/lstm_grad_cpu_kernel.cc
浏览文件 @
413e3eb5
...
...
@@ -104,6 +104,9 @@ void LSTMGradCPUKernel::CheckParam(const CNodePtr &kernel_node) {
num_directions_
=
2
;
}
const
int
gate_size
=
4
*
hidden_size_
;
if
(
num_layers_
<=
0
)
{
MS_LOG
(
EXCEPTION
)
<<
"layers must be greater than zero!"
;
}
for
(
int
i
=
0
;
i
<
num_layers_
;
++
i
)
{
weight_size_
+=
gate_size
*
(
i
==
0
?
input_size_
:
hidden_size_
*
num_directions_
);
weight_h_size_
+=
gate_size
*
hidden_size_
;
...
...
@@ -113,9 +116,6 @@ void LSTMGradCPUKernel::CheckParam(const CNodePtr &kernel_node) {
if
(
num_directions_
*
num_layers_
!=
SizeToInt
(
src_h_shape
[
0
]))
{
MS_LOG
(
EXCEPTION
)
<<
"error iteration shape!"
;
}
if
(
num_layers_
<=
0
)
{
MS_LOG
(
EXCEPTION
)
<<
"layers must be greater than zero!"
;
}
if
(
src_shape
.
size
()
!=
3
||
src_h_shape
.
size
()
!=
3
||
src_c_shape
.
size
()
!=
3
)
{
MS_LOG
(
EXCEPTION
)
<<
"lstm only support 3-D input!"
;
}
...
...
mindspore/ccsrc/backend/kernel_compiler/gpu/nccl/nccl_gpu_kernel.h
浏览文件 @
413e3eb5
...
...
@@ -109,9 +109,13 @@ class NcclGpuKernel : public GpuKernel {
auto
broadcast_funcptr
=
reinterpret_cast
<
Broadcast
>
(
dlsym
(
const_cast
<
void
*>
(
collective_handle_
),
"Broadcast"
));
MS_EXCEPTION_IF_NULL
(
broadcast_funcptr
);
CHECK_NCCL_RET_WITH_EXCEPT
((
*
broadcast_funcptr
)(
input_addr
,
output_addr
,
output_size_
/
sizeof
(
T
),
nccl_data_type_
,
root_
,
stream
,
group_name_
),
"ncclBroadcast failed"
);
for
(
int
i
=
0
;
i
<
SizeToInt
(
input_size_list_
.
size
());
++
i
)
{
input_addr
=
GetDeviceAddress
<
T
>
(
inputs
,
i
);
output_addr
=
GetDeviceAddress
<
T
>
(
outputs
,
i
);
CHECK_NCCL_RET_WITH_EXCEPT
((
*
broadcast_funcptr
)(
input_addr
,
output_addr
,
output_size_
/
sizeof
(
T
),
nccl_data_type_
,
root_
,
stream
,
group_name_
),
"ncclBroadcast failed"
);
}
break
;
}
default:
{
...
...
mindspore/nn/probability/distribution/categorical.py
浏览文件 @
413e3eb5
...
...
@@ -28,7 +28,7 @@ class Categorical(Distribution):
probs (Tensor, list, numpy.ndarray, Parameter, float): event probabilities.
logits (Tensor, list, numpy.ndarray, Parameter, float): event log-odds.
seed (int): seed to use in sampling. Default: 0.
dtype (m
indspore.dtype
): type of the distribution. Default: mstype.int32.
dtype (m
stype.int32
): type of the distribution. Default: mstype.int32.
name (str): name of the distribution. Default: Categorical.
Note:
...
...
@@ -49,7 +49,7 @@ class Categorical(Distribution):
>>>
>>> # Similar calls can be made to logits
>>> ans = self.ca.probs
>>> # value should be Tensor
>>> # value should be Tensor
(mstype.float32, bool, mstype.int32)
>>> ans = self.ca.log_prob(value)
>>>
>>> # Usage of enumerate_support
...
...
@@ -210,6 +210,8 @@ class Categorical(Distribution):
def
enumerate_support
(
self
,
expand
=
True
):
r
"""
Enumerate categories.
Args:
expand (Bool): whether to expand.
"""
num_events
=
self
.
_num_events
values
=
nn
.
Range
(
0.
,
num_events
,
1
)()
...
...
mindspore/ops/operations/random_ops.py
浏览文件 @
413e3eb5
...
...
@@ -439,7 +439,7 @@ class Multinomial(PrimitiveWithInfer):
Args:
seed (int): Seed data is used as entropy source for Random number engines generating pseudo-random numbers.
Must be non-negative. Default: 0.
replacement(bool)
- w
hether to draw with replacement or not.
replacement(bool)
: W
hether to draw with replacement or not.
Inputs:
- **input** (Tensor[float32]) - the input tensor containing the cumsum of probabilities, must be 1 or 2 dims.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录