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

Enhance look_up_table op #8932

Merged
merged 6 commits into from
Mar 14, 2018

Conversation

chengduoZH
Copy link
Contributor

@chengduoZH chengduoZH commented Mar 9, 2018

fix #8933

@chengduoZH chengduoZH changed the title [WIP] Enhance look_up_table op Enhance look_up_table op Mar 9, 2018
@chengduoZH chengduoZH force-pushed the feature/add_concat_rows branch 6 times, most recently from 0c7b04b to 5f1b8eb Compare March 12, 2018 05:49
@chengduoZH chengduoZH changed the title Enhance look_up_table op Add ConcatRows Op Mar 12, 2018
@@ -85,6 +91,44 @@ or not. And the output only shares the LoD information with input Ids.
}
};

class ConcatRowsOpMaker : public framework::OpProtoAndCheckerMaker {
Copy link
Member

Choose a reason for hiding this comment

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

I think this name is not so good and maybe we just need a python layer but not a new 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.

Thanks for your review @jacquesqiao
The parameters' meaning of ConcatRowsOp are different with LookUpTableOp, and the two operations' function is also different, so I define the new operation(ConcatRows). And I have added some annotation in the code.

Is your meaning that ConcatRowsOp is unnecessary?

@chengduoZH chengduoZH changed the title Add ConcatRows Op Enhance look_up_table op Mar 13, 2018
@chengduoZH chengduoZH force-pushed the feature/add_concat_rows branch 3 times, most recently from c9072d6 to 94e43e9 Compare March 13, 2018 11:01
W_array[i] *= i
W.set(W_array, place)

Out = scope.var('Out').get_selected_rows()
Copy link
Member

Choose a reason for hiding this comment

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

remote these lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

result_array = np.array(Out_tensor)

for idx, row in enumerate(rows):
assert (row == result_array[idx]).all()
Copy link
Member

@jacquesqiao jacquesqiao Mar 13, 2018

Choose a reason for hiding this comment

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

please add a comments about this usage of numpy.array

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@jacquesqiao jacquesqiao left a comment

Choose a reason for hiding this comment

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

LGTM!

@chengduoZH chengduoZH merged commit 788c600 into PaddlePaddle:develop Mar 14, 2018
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.

Making test_machine_translation.py supports regularization
2 participants