Skip to content
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 gather op. #11033

Merged
merged 4 commits into from
Jun 1, 2018

Conversation

wanghaoshuang
Copy link
Contributor

Add python wrapper for gather op.


Args:
input (Variable): The source input with rank>1.
index (Variable): The index input with rang=1.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rank?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx. Fixed.

**Gather Operator**

Out is obtained by gathering entries of the outer-most dimension
of X indexed by Index and concatenate them together.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Out -> Output
Index  -> `index`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx. Fixed.


.. code-block:: text

* Case 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还有其他Case吗?否则,就不要标Case了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx. Fixed.

index (Variable): The index input with rang=1.

Returns:
output (Variable): The output is a tensor with the same shape as input.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

输出和输入shape并不相同。


def gather(input, index):
"""
**Gather Operator**
Copy link
Contributor

@kuke kuke Jun 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Python API, there should not be any operator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx. Fixed.

[5, 6]]

Args:
input (Variable): The source input with rank>1.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gather_op should work even if rank == 1, please consider to modify it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx. The op support rank==1 already. I add a unitest for rank==1.

Copy link
Contributor

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@wanghaoshuang wanghaoshuang merged commit 86d8659 into PaddlePaddle:develop Jun 1, 2018
@wanghaoshuang wanghaoshuang deleted the gather branch May 20, 2022 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants