Skip to content

Commit

Permalink
Fix bug for prepare phi OP
Browse files Browse the repository at this point in the history
  • Loading branch information
From00 committed Mar 1, 2022
1 parent ce8ed97 commit bcb3a6b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions paddle/fluid/imperative/prepared_operator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,10 @@ PreparedOp PrepareImpl(const NameVarMap<VarType>& ins,
<< " | kernel key: " << pt_kernel_key
<< " | kernel: " << pt_kernel;

if (platform::is_cpu_place(expected_kernel_key.place_)) {
auto* cpu_ctx = pool.Get(paddle::platform::CPUPlace());
return PreparedOp(op, ctx, expected_kernel_key, pt_kernel_signature,
pt_kernel, cpu_ctx);
if (expected_kernel_key.place_ != place) {
dev_ctx = pool.Get(expected_kernel_key.place_);
}

// TODO(chenweihang): using CPUKernel when miss device kernel case
return PreparedOp(op, ctx, expected_kernel_key, pt_kernel_signature,
pt_kernel, dev_ctx);
Expand Down

1 comment on commit bcb3a6b

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

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

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.