Skip to content

Conversation

@chengduoZH
Copy link
Contributor

@chengduoZH chengduoZH commented Mar 9, 2018

fix #8933

@chengduoZH chengduoZH requested review from QiJune and jacquesqiao March 9, 2018 12:31
@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 force-pushed the feature/add_concat_rows branch from 5f1b8eb to f1c3ecb Compare March 12, 2018 05:50
@chengduoZH chengduoZH changed the title Enhance look_up_table op Add ConcatRows Op Mar 12, 2018
}
};

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 from 9140f73 to b9397b2 Compare March 13, 2018 05:57
@chengduoZH chengduoZH closed this Mar 13, 2018
@chengduoZH chengduoZH force-pushed the feature/add_concat_rows branch from 5de8215 to 1f757f5 Compare March 13, 2018 09:16
@chengduoZH chengduoZH reopened this 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
@chengduoZH chengduoZH force-pushed the feature/add_concat_rows branch from 94e43e9 to 92e2207 Compare March 13, 2018 11:03
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