While op forward for sentimental analysis#6140
Merged
reyoung merged 9 commits intoPaddlePaddle:developfrom Dec 4, 2017
Merged
Conversation
A v2 API like data feeder for book demos. We can feed data directly from reader.
…op_sentiment_analysis
…op_sentiment_analysis
QiJune
reviewed
Dec 4, 2017
| sentence = fluid.layers.data( | ||
| name='word', shape=[1], dtype='int64', lod_level=1) | ||
| sent_emb = fluid.layers.embedding( | ||
| input=sentence, size=[65535, 32], dtype='float32') |
c00349c to
6aae3ad
Compare
6aae3ad to
bf38d85
Compare
QiJune
reviewed
Dec 4, 2017
| return false; | ||
| if (ctrl_flow_ops.find(ops[op_index]->Type()) != | ||
| ctrl_flow_ops.end()) { | ||
| if (block_desc->HasVarRecursive(grad_var_name)) { |
Member
There was a problem hiding this comment.
In fact, variable in Control operator will be used in nested blocks. It's created in parent block, but used in children block. So it should be find recursively.
| // FIXME: Hack code here | ||
| auto& ctrl_flow_ops = CtrlFlowOps(); | ||
| if (ctrl_flow_ops.find(op_desc->Type()) == ctrl_flow_ops.end()) { | ||
| // Only computational op need drop input's gradient. |
Member
There was a problem hiding this comment.
In fact, the backward of Control Operator is not calculating gradient. So no_grad_vars does no sense to Control Operator.
| try { | ||
| return framework::make_ddim(var->Shape()); | ||
| auto shape = var->Shape(); | ||
| if (shape.empty()) { |
Member
There was a problem hiding this comment.
In which case, the shape is empty?
Collaborator
Author
There was a problem hiding this comment.
The final step of RNN network. Memory's gradient could be empty.
QiJune
reviewed
Dec 4, 2017
| framework::CopyFrom(x_array[offset], dev_ctx.GetPlace(), dev_ctx, | ||
| out_tensor); | ||
| out_tensor->set_lod(x_array[offset].lod()); | ||
| } else { |
Member
There was a problem hiding this comment.
In which case will offset > x_array.size() occur? Why not throw exception here?
Collaborator
Author
There was a problem hiding this comment.
Final timestep, memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #6139
Also, Fix #6134, Fix #6135
Base on PR #6102