Polish doc for lod_rank_table.

cross_channel_norm
yangyaming 8 years ago
parent 10cd6eb67a
commit 57bc564d12

@ -397,20 +397,29 @@ class While(object):
def lod_rank_table(x, level=0): def lod_rank_table(x, level=0):
"""LoD Rank Table Operator. Given an input variable `x` and a LoD level, """LoD Rank Table Operator. Given an input variable **x** and a level number
this layer creates a LodRankTable object. A LoDRankTable object contains a of LoD, this layer creates a LodRankTable object. A LoDRankTable object
list of bi-element tuples and each tuple consists of an index and a length. contains a list of bi-element tuples. Each tuple consists of an index and
For given level's LoD information, the index is the sequence position and a length, both of which are int type. Reffering to specified level of LoD,
the length representes the sequence length. Please note that the list is the index is the sequence index number and the length representes the
ranked in descending order by the length. The following is an example: sequence length. Please note that the list is ranked in descending order by
the length. The following is an example:
.. code-block:: text .. code-block:: text
x is a LoDTensor: x is a LoDTensor:
x.lod = [[0, 1, 2, 3], x.lod = [[0, 2, 3],
[0, 5, 6, 7]] [0, 5, 6, 7]]
x.data = [a, b, c, d, e, f, g] x.data = [a, b, c, d, e, f, g]
1. set level to 0:
Create lod rank table:
lod_rank_table_obj = lod_rank_table(x, level=0)
Get:
lod_rank_table_obj.items() = [(0, 2), (1, 1)]
2. set level to 1:
Create lod rank table: Create lod rank table:
lod_rank_table_obj = lod_rank_table(x, level=1) lod_rank_table_obj = lod_rank_table(x, level=1)

Loading…
Cancel
Save