FlexNN 1
Fully connected neural network built from scratch with flexible n-layer design and multiple activations.
Loading...
Searching...
No Matches
ModelIO.hpp
Go to the documentation of this file.
1
13#pragma once
14
15#include <cstdint>
16#include <string>
17
18#include "FlexNN.h"
19
20namespace FlexNN {
21
29struct Status {
30 bool ok = true;
31 std::string error;
32
33 static Status Ok() { return {true, ""}; }
34 static Status Err(std::string msg) { return {false, std::move(msg)}; }
35};
36
46 int formatVersion = 2;
47};
48
63[[nodiscard]] Status exportModel(const NeuralNetwork& net, const std::string& path,
64 ExportOptions opts = {});
65
77[[nodiscard]] Status importModel(NeuralNetwork& net, const std::string& path);
78
79} // namespace FlexNN
Header for FlexNN neural network (heterogeneous stack via Layers::Layer).
Linear stack of heterogeneous layers (vector<Layers::Layer>).
Definition FlexNN.h:47
Namespace for the FlexNN neural network library.
Definition Activation.hpp:31
Status exportModel(const NeuralNetwork &net, const std::string &path, ExportOptions opts={})
Export a trained NeuralNetwork to flat binary model.bin.
Definition ModelIO.cpp:144
Status importModel(NeuralNetwork &net, const std::string &path)
Import a flat binary model.bin into a NeuralNetwork.
Definition ModelIO.cpp:479
Options for export (currently version).
Definition ModelIO.hpp:45
int formatVersion
1=legacy, 2=with ActivationParameters
Definition ModelIO.hpp:46
Result of export/import.
Definition ModelIO.hpp:29
bool ok
Definition ModelIO.hpp:30
static Status Err(std::string msg)
Definition ModelIO.hpp:34
static Status Ok()
Definition ModelIO.hpp:33
std::string error
Definition ModelIO.hpp:31