Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
2efdf0ef
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看板
未验证
提交
2efdf0ef
编写于
9月 24, 2019
作者:
Y
Yi Liu
提交者:
GitHub
9月 24, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update en document of shard_index_op (#19963)
test=develop test=document_fix
上级
766bd529
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
30 deletion
+24
-30
paddle/fluid/API.spec
paddle/fluid/API.spec
+1
-1
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+23
-29
未找到文件。
paddle/fluid/API.spec
浏览文件 @
2efdf0ef
...
@@ -296,7 +296,7 @@ paddle.fluid.layers.deformable_conv (ArgSpec(args=['input', 'offset', 'mask', 'n
...
@@ -296,7 +296,7 @@ paddle.fluid.layers.deformable_conv (ArgSpec(args=['input', 'offset', 'mask', 'n
paddle.fluid.layers.unfold (ArgSpec(args=['x', 'kernel_sizes', 'strides', 'paddings', 'dilations', 'name'], varargs=None, keywords=None, defaults=(1, 0, 1, None)), ('document', '3f884662ad443d9ecc2b3734b4f61ad6'))
paddle.fluid.layers.unfold (ArgSpec(args=['x', 'kernel_sizes', 'strides', 'paddings', 'dilations', 'name'], varargs=None, keywords=None, defaults=(1, 0, 1, None)), ('document', '3f884662ad443d9ecc2b3734b4f61ad6'))
paddle.fluid.layers.deformable_roi_pooling (ArgSpec(args=['input', 'rois', 'trans', 'no_trans', 'spatial_scale', 'group_size', 'pooled_height', 'pooled_width', 'part_size', 'sample_per_part', 'trans_std', 'position_sensitive', 'name'], varargs=None, keywords=None, defaults=(False, 1.0, [1, 1], 1, 1, None, 1, 0.1, False, None)), ('document', '99c03e3f249e36854f87dedaa17c8f35'))
paddle.fluid.layers.deformable_roi_pooling (ArgSpec(args=['input', 'rois', 'trans', 'no_trans', 'spatial_scale', 'group_size', 'pooled_height', 'pooled_width', 'part_size', 'sample_per_part', 'trans_std', 'position_sensitive', 'name'], varargs=None, keywords=None, defaults=(False, 1.0, [1, 1], 1, 1, None, 1, 0.1, False, None)), ('document', '99c03e3f249e36854f87dedaa17c8f35'))
paddle.fluid.layers.filter_by_instag (ArgSpec(args=['ins', 'ins_tag', 'filter_tag', 'is_lod'], varargs=None, keywords=None, defaults=None), ('document', '7703a2088af8de4128b143ff1164ca4a'))
paddle.fluid.layers.filter_by_instag (ArgSpec(args=['ins', 'ins_tag', 'filter_tag', 'is_lod'], varargs=None, keywords=None, defaults=None), ('document', '7703a2088af8de4128b143ff1164ca4a'))
paddle.fluid.layers.shard_index (ArgSpec(args=['input', 'index_num', 'nshards', 'shard_id', 'ignore_value'], varargs=None, keywords=None, defaults=(-1,)), ('document', '
5786fdbba6753ecd6cbce5e6b0889924
'))
paddle.fluid.layers.shard_index (ArgSpec(args=['input', 'index_num', 'nshards', 'shard_id', 'ignore_value'], varargs=None, keywords=None, defaults=(-1,)), ('document', '
c4969dd6bf164f9e6a90414ea4f4e5ad
'))
paddle.fluid.layers.hard_swish (ArgSpec(args=['x', 'threshold', 'scale', 'offset', 'name'], varargs=None, keywords=None, defaults=(6.0, 6.0, 3.0, None)), ('document', '6a5152a7015c62cb8278fc24cb456459'))
paddle.fluid.layers.hard_swish (ArgSpec(args=['x', 'threshold', 'scale', 'offset', 'name'], varargs=None, keywords=None, defaults=(6.0, 6.0, 3.0, None)), ('document', '6a5152a7015c62cb8278fc24cb456459'))
paddle.fluid.layers.mse_loss (ArgSpec(args=['input', 'label'], varargs=None, keywords=None, defaults=None), ('document', 'd9ede6469288636e1b3233b461a165c9'))
paddle.fluid.layers.mse_loss (ArgSpec(args=['input', 'label'], varargs=None, keywords=None, defaults=None), ('document', 'd9ede6469288636e1b3233b461a165c9'))
paddle.fluid.layers.data (ArgSpec(args=['name', 'shape', 'append_batch_size', 'dtype', 'lod_level', 'type', 'stop_gradient'], varargs=None, keywords=None, defaults=(True, 'float32', 0, VarType.LOD_TENSOR, True)), ('document', '9d7806e31bdf727c1a23b8782a09b545'))
paddle.fluid.layers.data (ArgSpec(args=['name', 'shape', 'append_batch_size', 'dtype', 'lod_level', 'type', 'stop_gradient'], varargs=None, keywords=None, defaults=(True, 'float32', 0, VarType.LOD_TENSOR, True)), ('document', '9d7806e31bdf727c1a23b8782a09b545'))
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
2efdf0ef
...
@@ -14122,52 +14122,46 @@ def deformable_roi_pooling(input,
...
@@ -14122,52 +14122,46 @@ def deformable_roi_pooling(input,
def shard_index(input, index_num, nshards, shard_id, ignore_value=-1):
def shard_index(input, index_num, nshards, shard_id, ignore_value=-1):
"""
"""
This
layer creates the sharded index for input. This layers is used in
This
function recomputes the `input` indices according to the offset of the
model- and data- parallel mixed training generally, in which the index
shard. The length of the indices is evenly divided into N shards, and if
data (usually the label) should be recaculated in each trainer according
the `shard_id` matches the shard with the input index inside, the index is
to
recomputed on the basis of the shard offset, elsewise it is set to
`ignore_value`. The detail is as follows:
.. math::
::
assert index_num % nshards == 0
shard_size = (index_num + nshards - 1) // nshards
y = x % shard_size if x // shard_size == shard_id else ignore_value
shard_size = index_num / nshards
y = x % shard_size if x / shard_size == shard_id else ignore_value
We take the distributed one-hot representation to show what this layer is
NOTE: If the length of indices cannot be evely divided by the shard number,
used for. The distributed one-hot representation is seperated into multiple
the size of the last shard will be less than the calculated `shard_size`
shards, and each shard is filling zeros except the one with the index
inside. In order to create these sharded representation in each trainer,
the original index should be recalculated (i.e. sharded) before.
Examples:
Examples:
::
X is a Tensor of integer values
:
Input
:
X.shape = [4, 1]
X.shape = [4, 1]
X.data = [[1], [6], [12], [19]]
X.data = [[1], [6], [12], [19]]
index_num = 20
nshards = 2
ignore_value = -1
suppose index_num = 20 and nshards = 2, then we get shard_size = 10
if shard_id == 0, we get:
if shard_id == 0, we get the Out:
Out.shape = [4, 1]
Out.shape = [4, 1]
Out.data = [[1], [6], [-1], [-1]]
Out.data = [[1], [6], [-1], [-1]]
if shard_id == 1, we get
the Out
:
if shard_id == 1, we get:
Out.shape = [4, 1]
Out.shape = [4, 1]
Out.data = [[-1], [-1], [2], [9]]
Out.data = [[-1], [-1], [2], [9]]
the default `ignore_value` -1 is used in this example.
Args:
Args:
input
(Variable): Input indices, last dimension must be 1.
- **input**
(Variable): Input indices, last dimension must be 1.
index_num
(scalar): An interger defining the range of the index.
- **index_num**
(scalar): An interger defining the range of the index.
nshards
(scalar): The number of shards
- **nshards**
(scalar): The number of shards
shard_id
(scalar): The index of the current shard
- **shard_id**
(scalar): The index of the current shard
ignore_value
(scalar): An ingeter value out of sharded index range
- **ignore_value**
(scalar): An ingeter value out of sharded index range
Returns:
Returns:
Variable: The shard index of input.
Variable: The shard
ed
index of input.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录