Skip to content

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

4 participants