-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 python wrapper for multiplex operator. #7739
Conversation
… fix-7717 Conflicts: doc/api/v2/fluid/layers.rst python/paddle/v2/fluid/layers/nn.py python/paddle/v2/fluid/tests/test_layers.py
python/paddle/v2/fluid/layers/nn.py
Outdated
input variables and let :math:`I_i` represents the i-th input variable and i | ||
is in [0, :math:`m`). All input variables are tensors with same shape | ||
[:math:`d_0`, :math:`d_1`, ..., :math:`d_R`]. Please note that rank of the | ||
input tensor should be at least 2. Each input variable will be viewed as a |
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.
viewed
-> treated
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.
Done.
python/paddle/v2/fluid/layers/nn.py
Outdated
and :math:`N` for :math:`d_1` * :math:`d_2` * ... * :math:`d_R`. Let | ||
:math:`I_i[j]` be the j-th row of the i-th input variable. The given index | ||
variable should be a 2-D tensor with shape [:math:`M`, 1]. Let `ID[i]` be | ||
the i-th index value of index variable. Then the output variable will be a |
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.
the i-th index value of index variable
-> the i-th index of the index variable
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.
Done.
python/paddle/v2/fluid/layers/nn.py
Outdated
:math:`I_i[j]` be the j-th row of the i-th input variable. The given index | ||
variable should be a 2-D tensor with shape [:math:`M`, 1]. Let `ID[i]` be | ||
the i-th index value of index variable. Then the output variable will be a | ||
tensor with shape [:math:`d_0`, :math:`d_1`, ..., :math:`d_R`]. If we view |
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.
view
-> treat
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.
Done.
python/paddle/v2/fluid/layers/nn.py
Outdated
the i-th index value of index variable. Then the output variable will be a | ||
tensor with shape [:math:`d_0`, :math:`d_1`, ..., :math:`d_R`]. If we view | ||
the output tensor as a 2-D matrix with shape [:math:`M`, :math:`N`] and let | ||
:math:`O[i]` be the i-th row of the matrix, then values of `O[i]` come from |
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.
then values of O[i] come from
-> then O[i] is equal to
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.
Done. Thanks.
python/paddle/v2/fluid/layers/nn.py
Outdated
:math:`I_{ID[i]}[i]`. | ||
|
||
Args: | ||
inputs (list): Input variables which are tensors with same shape and the |
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.
Input variables which are tensors with same shape
-> A variable list in which every variable has the same shape
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.
Done.
python/paddle/v2/fluid/layers/nn.py
Outdated
inputs (list): Input variables which are tensors with same shape and the | ||
rank is at least 2. | ||
index (Variable): Tensor<int32>, index variable which is a 2-D tensor | ||
with shape [M, 1] where M for batch size. |
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.
where M for batch size
-> where M is the batch size
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.
Done.
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.
Two more fixes
python/paddle/v2/fluid/layers/nn.py
Outdated
|
||
Referring to the given index variable, this layer gathers from the input | ||
variables to output a multiplex variable. Assuming that there are :math:`m` | ||
input variables and let :math:`I_i` represents the i-th input variable and i |
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.
represents
->represent
or delete let
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.
Done.
python/paddle/v2/fluid/layers/nn.py
Outdated
""" | ||
**Multiplex Layer** | ||
|
||
Referring to the given index variable, this layer gathers from the input |
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 layer gathers from the input variables to output a multiplex variable
-> this layer fetches rows from the input variables and constructs a multiplex variable for output
gather
is not a suitable word.
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.
Thanks, done.
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.
LGTM
Resolves #7717