Skip to content

Add Parameter Header in V2 API #3519

@luotao1

Description

@luotao1

In v1 api, there is parameter header in paddle/parameter/Parameter.h

 struct Header {
    int32_t version;     // = 0, file format version
    uint32_t valueSize;  // = sizeof(real)
    uint64_t size;       // = getSize()
  };

While in v2 api, it directly writes f.write(struct.pack("IIQ", 0, 4, size)) in python/paddle/v2/parameters.py#L282

 def serialize(self, name, f):
        param = self.get(name)
        size = reduce(lambda a, b: a * b, param.shape)
        f.write(struct.pack("IIQ", 0, 4, size))

Thus, we can't use version to distinguish different parameters: such as mkldnn parameters and paddle parameters. So, we should add the parameter header in V2 api too.

related with #3409

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions