-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add doc for AggregateLevel and ExpandLevel #2200
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,6 +225,24 @@ def is_layer_type(type_name): | |
|
||
|
||
class AggregateLevel(object): | ||
""" | ||
PaddlePaddle supports three sequence types: | ||
|
||
- :code:`SequenceType.NO_SEQUENCE` means the sample is not a sequence. | ||
- :code:`SequenceType.SEQUENCE` means the sample is a sequence. | ||
- :code:`SequenceType.SUB_SEQUENCE` means the sample is a nested sequence, | ||
each timestep of which is also a sequence. | ||
|
||
Accordingly, AggregateLevel supports two modes: | ||
|
||
- :code:`AggregateLevel.EACH_TIMESTEP` means the aggregation acts on each | ||
timestep of a sequence, both :code:`SUB_SEQUENCE` and :code:`SEQUENCE` will | ||
be aggregated to :code:`NO_SEQUENCE`. | ||
|
||
- :code:`AggregateLevel.EACH_SEQUENCE` means the aggregation acts on each | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accordingly, TO_SEQUENCE will be easier to understand. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, I will change the name in next PR. |
||
sequence of a nested sequence, :code:`SUB_SEQUENCE` will be aggregated to | ||
:code:`SEQUENCE`. | ||
""" | ||
EACH_TIMESTEP = 'non-seq' | ||
EACH_SEQUENCE = 'seq' | ||
|
||
|
@@ -1454,6 +1472,19 @@ def first_seq(input, | |
|
||
|
||
class ExpandLevel(object): | ||
""" | ||
Please refer to AggregateLevel first. | ||
|
||
ExpandLevel supports two modes: | ||
|
||
- :code:`ExpandLevel.FROM_TIMESTEP` means the expandation acts on each | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. expandation => expansion There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, I will fix it in next PR. |
||
timestep of a sequence, :code:`NO_SEQUENCE` will be expanded to | ||
:code:`SEQUENCE` or :code:`SUB_SEQUENCE`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "acts on each timestep of a sequence" is not correct because the input for FROM_TIMESTEP is non-sequence. Perhaps we should consider change the name to FROM_NON_SEQUENCE. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, I will change the name in next PR. |
||
|
||
- :code:`ExpandLevel.FROM_SEQUENCE` means the expandation acts on each | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. expandation=> expansion There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, I will fix it in next PR. |
||
sequence of a nested sequence, :code:`SEQUENCE` will be expanded to | ||
:code:`SUB_SEQUENCE`. | ||
""" | ||
FROM_TIMESTEP = AggregateLevel.EACH_TIMESTEP | ||
FROM_SEQUENCE = AggregateLevel.EACH_SEQUENCE | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually aggregates over the whole sequence. Maybe change the name to TO_NON_SEUQNCE will be easier to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, I will change the name in next PR.