Skip to content

Support model deinit

Sam Eadie requested to merge sameadie/sadl:model_deinit into master

During a model's initialisation, some modifications are made to the model including inserting copy layers, and rearranging certain parameters. This prohibits utility scripts (e.g. in sadl/sample) to dump the model after initialisation. This MR adds support for undoing these operations, allowing model dumping. For example:

ifstream file(filename, ios::binary);
model.load(file);
std::vector<sadl::Tensor<T>> inputs = model.getInputsTemplate();
model.init(inputs);
model.removeCopyLayers();
model.reshapeMatrix(true);
model.reshapeConv2DFilters(true);
ofstream file_out(filename_out, ios::binary);
model.dump(file_out);

Merge request reports