8 #ifndef NNLIB_NETWORK_H
9 #define NNLIB_NETWORK_H
73 void add(
size_t numNeurons,
const std::string& activation =
"linear");
83 sTensor
forward(
const sTensor& batch);
100 void train(sTensor& X, sTensor& y,
int epochs,
size_t batchSize,
float learningRate,
Loss* loss,
101 std::vector<Metric*>& metrics);
118 void processEpoch(std::vector<sTensor>& batches, std::vector<sTensor>& targets, std::vector<sTensor>& targetsOnHost,
119 float learningRate,
Loss* loss, std::vector<Metric*>& metrics);
DataLocation
Enumerate to specify where data is located.
Definition: cache.h:24
Abstract class representing a loss function.
Definition: loss.h:21
Represents a neural network.
Definition: network.h:23
DataLocation location
The location of the network.
Definition: network.h:29
sTensor forward(const sTensor &batch)
Forward-propagate a batch through the network.
Definition: network.cpp:186
void train(sTensor &X, sTensor &y, int epochs, size_t batchSize, float learningRate, Loss *loss, std::vector< Metric * > &metrics)
Train the network.
Definition: network.cpp:198
std::vector< Layer > layers
List of network layers.
Definition: network.h:34
long long seed
Seed used for random initialization.
Definition: network.h:39
void processEpoch(std::vector< sTensor > &batches, std::vector< sTensor > &targets, std::vector< sTensor > &targetsOnHost, float learningRate, Loss *loss, std::vector< Metric * > &metrics)
Trains the model on a single epoch.
Definition: network.cpp:229
void add(size_t numNeurons, const std::string &activation="linear")
Add a new layer to the network.
Definition: network.cpp:178
size_t previousSize
Keeps track of the size of the previous layer.
Definition: network.h:48
Network(size_t inputSize, bool useGPU=true, long long seed=NO_SEED)
Construct a new network.
Definition: network.cpp:166
Header file declaring the Layer class.
Header file declaring different loss functions.
#define NO_SEED
Integer to mean that no seed was specified for the network.
Definition: network.h:18