libdl  0.0.1
Simple yet powerful deep learning
Loading...
Searching...
No Matches
dl::io::WeightsFileFormat Class Referenceabstract

Public Member Functions

virtual bool loadModelFromStream (dl::ModelBase &model, std::istream &stream)=0
 Populates the model's weights and metainformation from the provided stream.
 
virtual bool loadModelFromFile (dl::ModelBase &model, std::filesystem::path &path, bool mmap=true)=0
 Populates the model's weights and metainformation from the given file.
 
virtual void writeModelToStream (dl::ModelBase &model, std::ostream &stream)=0
 

Detailed Description

Definition at line 11 of file weightsfile.hpp.

Member Function Documentation

◆ loadModelFromFile()

virtual bool dl::io::WeightsFileFormat::loadModelFromFile ( dl::ModelBase model,
std::filesystem::path &  path,
bool  mmap = true 
)
pure virtual

Populates the model's weights and metainformation from the given file.

Parameters
modelThe model to load the information into.
path
mmap
Returns
true iff the model was successfully loaded from the file.

◆ loadModelFromStream()

virtual bool dl::io::WeightsFileFormat::loadModelFromStream ( dl::ModelBase model,
std::istream stream 
)
pure virtual

Populates the model's weights and metainformation from the provided stream.

This implementation does not assume the stream to be seekable. That is, it does not "jump around". Because of this, it may be more memory intensive than WeightsFileFormat::loadModelFromFile(dl::ModelBase&,std::filesystem::path&,bool), which can make use of that it knows that it reads from a file and can jump around and memory map it. Instead, this implementation provides more flexibility since the stream could for example be a dl::utils::URLStream.

Parameters
modelThe model to load the information into.
stream
Returns
true iff the model was successfully loaded from the stream.

The documentation for this class was generated from the following file: