Skip to content

Commit

Permalink
fix by comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gongweibao committed Mar 21, 2018
1 parent e25a270 commit 0d36059
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions paddle/fluid/operators/detail/tensor_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ bool ReadRaw(::google::protobuf::io::CodedInputStream* input,
if (!input->GetDirectBufferPointer(&data, &size_to_write)) {
return false;
}
// TODO(gongwb): don't copy if it's aligned?
memcpy(reinterpret_cast<void*>(p), data, size_to_write);
// TODO(gongwb): can we avoid copy?
platform::CPUPlace cpu;
memory::Copy(cpu, reinterpret_cast<void*>(p), cpu, data, size_to_write);

p += size_to_write;
size -= size_to_write;
Expand Down Expand Up @@ -154,7 +155,7 @@ bool TensorResponse::CopySelectRowsData(
auto* slr = var->GetMutable<framework::SelectedRows>();
int64_t* rows_data = slr->mutable_rows()->data();

// copy rows CPU data, GPU data will be copied lazly
// copy rows CPU data, GPU data will be copied lazily.
platform::CPUPlace cpu;
if (!ReadRaw(input, ctx, cpu, rows_data, length)) {
return false;
Expand Down

0 comments on commit 0d36059

Please sign in to comment.