FlexNN 1
Fully connected neural network built from scratch with flexible n-layer design and multiple activations.
Loading...
Searching...
No Matches
FlexNN.cpp File Reference

Implements FlexNN::NeuralNetwork with heterogeneous Layers::Layer variant. More...

#include "FlexNN.h"
#include <cassert>
#include <iostream>
#include <vector>
#include <Eigen/Dense>
#include "Utility.h"
#include "activations/Activation.hpp"
Include dependency graph for FlexNN.cpp:

Namespaces

namespace  FlexNN
 Namespace for the FlexNN neural network library.
 

Detailed Description

Implements FlexNN::NeuralNetwork with heterogeneous Layers::Layer variant.

After PR-04, the network holds vector<Layers::Layer> where each Layer is a variant<Dense, ...> (currently only Dense). Forward/backward use std::visit via Layer::forward/backward. The last-layer Softmax + cross-entropy is fused as dZ = (A - Y)/m in backward() — never calling Dense::backward for the last layer when it is Softmax, which fixes the legacy lib/Layer.cpp:72 Jacobian bug.

The legacy NeuralNetwork(vector<Layer>) (stringly-typed Dense) is kept as a deprecated shim that converts each old Layer to Layers::Dense via Activations::try_parse.