|
|
|
@ -114,7 +114,7 @@ bool VariableResponse::CopyLodTensorData(
|
|
|
|
|
tensor->set_lod(lod);
|
|
|
|
|
|
|
|
|
|
void* tensor_data =
|
|
|
|
|
tensor->mutable_data(ctx.GetPlace(), ToTypeIndex(meta_.data_type()));
|
|
|
|
|
tensor->mutable_data(ctx.GetPlace(), ToVarType(meta_.data_type()));
|
|
|
|
|
|
|
|
|
|
VLOG(6) << "Tensor.memory_size = " << tensor->memory_size()
|
|
|
|
|
<< ", Buffer Size = " << length;
|
|
|
|
@ -139,13 +139,13 @@ bool VariableResponse::CopySelectRowsTensorData(
|
|
|
|
|
slr->set_height(meta_.slr_height());
|
|
|
|
|
auto* tensor = slr->mutable_value();
|
|
|
|
|
tensor->Resize(dims);
|
|
|
|
|
PADDLE_ENFORCE_EQ(static_cast<size_t>(tensor->numel()),
|
|
|
|
|
length / framework::SizeOfType(
|
|
|
|
|
paddle::operators::distributed::ToTypeIndex(
|
|
|
|
|
meta_.data_type())));
|
|
|
|
|
PADDLE_ENFORCE_EQ(
|
|
|
|
|
static_cast<size_t>(tensor->numel()),
|
|
|
|
|
length / framework::SizeOfType(paddle::operators::distributed::ToVarType(
|
|
|
|
|
meta_.data_type())));
|
|
|
|
|
void* tensor_data = tensor->mutable_data(
|
|
|
|
|
ctx.GetPlace(),
|
|
|
|
|
paddle::operators::distributed::ToTypeIndex(meta_.data_type()));
|
|
|
|
|
paddle::operators::distributed::ToVarType(meta_.data_type()));
|
|
|
|
|
|
|
|
|
|
if (!ReadRaw(input, ctx, tensor->place(), tensor_data, length)) {
|
|
|
|
|
return false;
|
|
|
|
@ -159,8 +159,7 @@ bool VariableResponse::CopySelectRowsData(
|
|
|
|
|
const platform::DeviceContext& ctx, int length) {
|
|
|
|
|
auto* slr = GetVar()->GetMutable<framework::SelectedRows>();
|
|
|
|
|
slr->mutable_rows()->clear();
|
|
|
|
|
slr->mutable_rows()->resize(length /
|
|
|
|
|
framework::SizeOfType(typeid(int64_t))); // int64
|
|
|
|
|
slr->mutable_rows()->resize(length / sizeof(int64_t)); // int64
|
|
|
|
|
int64_t* rows_data = slr->mutable_rows()->data();
|
|
|
|
|
|
|
|
|
|
// copy rows CPU data, GPU data will be copied lazily.
|
|
|
|
|