need to copy LoD info (#10392)

simplify_fluid_api_recognize_digit
Kexin Zhao 7 years ago committed by GitHub
parent 773bf29b70
commit ccc594e4c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -106,6 +106,8 @@ class SaveOp : public framework::OperatorBase {
auto out_kernel_type = framework::OpKernelType(out_dtype, place);
framework::LoDTensor out;
framework::TransDataType(in_kernel_type, out_kernel_type, tensor, &out);
// copy LoD info to the new tensor
out.set_lod(tensor.lod());
framework::SerializeToStream(fout, out, dev_ctx);
} else {
framework::SerializeToStream(fout, tensor, dev_ctx);

Loading…
Cancel
Save