Skip to content

Commit

Permalink
Change lod_level to legacy_lod_level (#1451)
Browse files Browse the repository at this point in the history
  • Loading branch information
co63oc authored Dec 6, 2024
1 parent 2baaa03 commit fbc3b90
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions paddle2onnx/parser/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ bool PaddleParser::LoadParamsFromMemoryBuffer(
read_size += sizeof(version);
}
{
// read lod_level, we don't use it
// read legacy_lod_level, we don't use it
// this has to be zero, otherwise not support
uint64_t lod_level;
params_buffer.copy(reinterpret_cast<char*>(&lod_level), sizeof(lod_level),
uint64_t legacy_lod_level;
params_buffer.copy(reinterpret_cast<char*>(&legacy_lod_level), sizeof(legacy_lod_level),
read_size);
read_size += sizeof(lod_level);
if (lod_level != 0) {
P2OLogger() << "Only supports weight with lod_level = 0." << std::endl;
read_size += sizeof(legacy_lod_level);
if (legacy_lod_level != 0) {
P2OLogger() << "Only supports weight with legacy_lod_level = 0." << std::endl;
return false;
}
}
Expand Down Expand Up @@ -202,14 +202,14 @@ bool PaddleParser::LoadParamsFromMemoryBuffer(const void* params_buffer,
params_size -= sizeof(version);
}
{
// read lod_level, we don't use it
// read legacy_lod_level, we don't use it
// this has to be zero, otherwise not support
uint64_t lod_level;
std::memcpy(&lod_level, read_pointer, sizeof(lod_level));
read_pointer += sizeof(lod_level);
params_size -= sizeof(lod_level);
if (lod_level != 0) {
P2OLogger() << "Only supports weight with lod_level = 0." << std::endl;
uint64_t legacy_lod_level;
std::memcpy(&legacy_lod_level, read_pointer, sizeof(legacy_lod_level));
read_pointer += sizeof(legacy_lod_level);
params_size -= sizeof(legacy_lod_level);
if (legacy_lod_level != 0) {
P2OLogger() << "Only supports weight with legacy_lod_level = 0." << std::endl;
return false;
}
}
Expand Down Expand Up @@ -280,13 +280,13 @@ bool PaddleParser::LoadParams(const std::string& path) {
is.read(reinterpret_cast<char*>(&version), sizeof(version));
}
{
// read lod_level, we don't use it
// read legacy_lod_level, we don't use it
// this has to be zero, otherwise not support
uint64_t lod_level;
read_size += sizeof(lod_level);
is.read(reinterpret_cast<char*>(&lod_level), sizeof(lod_level));
Assert(lod_level == 0,
"Paddle2ONNX: Only support weight with lod_level = 0.");
uint64_t legacy_lod_level;
read_size += sizeof(legacy_lod_level);
is.read(reinterpret_cast<char*>(&legacy_lod_level), sizeof(legacy_lod_level));
Assert(legacy_lod_level == 0,
"Paddle2ONNX: Only support weight with legacy_lod_level = 0.");
}
{
// Another version, we don't use it
Expand Down
4 changes: 2 additions & 2 deletions paddle2onnx/proto/p2o_paddle.proto
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ message VarType {

message DenseTensorDesc {
required TensorDesc tensor = 1;
optional int32 lod_level = 2 [ default = 0 ];
optional int32 legacy_lod_level = 2 [ default = 0 ];
}
optional DenseTensorDesc dense_tensor = 3;

message DenseTensorArrayDesc {
required TensorDesc tensor = 1;
optional int32 lod_level = 2 [ default = 0 ];
optional int32 legacy_lod_level = 2 [ default = 0 ];
}
optional DenseTensorArrayDesc tensor_array = 4;

Expand Down

0 comments on commit fbc3b90

Please sign in to comment.