API Reference
Abovo: A C++ neural network engine with Python bindings for educational performance optimization.
- class abovo.ActivationType(*values)[source]
Bases:
IntEnum- LEAKY_RELU = 1
- RELU = 0
- SIGMOID = 2
- SOFTMAX = 3
- class abovo.DenseLayer(spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs)[source]
Bases:
DenseLayerMockA fully connected neural network layer with optional quantization and activation.
- Parameters:
input_size (int) – Number of input features.
output_size (int) – Number of output features.
activation (ActivationType) – Activation function to apply.
- dequantize()[source]
Dequantizes the layer weights.
- is_quantized()[source]
Returns whether the layer is currently quantized.
- Return type:
bool
- print()[source]
Prints the layer’s weights and configuration.
- quantize()[source]
Quantizes the layer weights (useful for efficient inference).
- class abovo.LossType(*values)[source]
Bases:
IntEnum- CROSS_ENTROPY = 1
- MSE = 0
- class abovo.MatMulType(*values)[source]
Bases:
IntEnum- BLOCKED = 1
- NAIVE = 0
- SIMD = 2
- SIMD_MT = 3
- class abovo.Matrix(spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs)[source]
Bases:
MatrixMockA 2D matrix supporting basic operations like transpose, min/max lookup, and element access.
- Parameters:
rows (int) – Number of rows.
cols (int) – Number of columns.
- get_cols()[source]
Returns the number of columns in the matrix.
- Return type:
int
- get_max()[source]
Returns the maximum value in the matrix.
- Return type:
float
- get_min()[source]
Returns the minimum value in the matrix.
- Return type:
float
- get_rows()[source]
Returns the number of rows in the matrix.
- Return type:
int
- print()[source]
Prints the matrix to stdout.
- class abovo.Sequential(spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs)[source]
Bases:
SequentialMockA sequential model for stacking layers and training.
- add(layer)[source]
Add a DenseLayer to the model.
- forward(X)[source]
Perform a forward pass.
- train(...)[source]
Train the model with given parameters.
- evaluate(...)[source]
Evaluate model accuracy.
- quantize_all()[source]
Quantize all layers.
- dequantize_all()[source]
Revert quantization.
- enable_qat()[source]
Enable quantization-aware training.
- enable_adam(...)[source]
Use Adam optimizer.
- add(layer)[source]
Adds a new DenseLayer to the model.
- dequantize_all()[source]
Dequantizes all layers.
- enable_adam(enable=True, beta1=0.9, beta2=0.999, epsilon=1e-08)[source]
Enables Adam optimizer with given hyperparameters.
- Parameters:
enable (bool) – Whether to use Adam.
beta1 (float) – Exponential decay rate for 1st moment.
beta2 (float) – Exponential decay rate for 2nd moment.
epsilon (float) – Small value to avoid division by zero.
- enable_qat()[source]
Enables quantization-aware training.
- evaluate(X, y)[source]
Evaluates model performance on test data.
- print()[source]
Prints the model structure and parameters.
- quantize_all(per_channel=True)[source]
Quantizes all layers in the model.
- train(X, y, epochs, batch_size, learning_rate, loss_type=LossType.MSE)[source]
Trains the model on data using gradient descent.
Matrix
- class abovo.Matrix(spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs)[source]
Bases:
MatrixMockA 2D matrix supporting basic operations like transpose, min/max lookup, and element access.
- Parameters:
rows (int) – Number of rows.
cols (int) – Number of columns.
DenseLayer
- class abovo.DenseLayer(spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs)[source]
Bases:
DenseLayerMockA fully connected neural network layer with optional quantization and activation.
- Parameters:
input_size (int) – Number of input features.
output_size (int) – Number of output features.
activation (ActivationType) – Activation function to apply.
Sequential
- class abovo.Sequential(spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs)[source]
Bases:
SequentialMockA sequential model for stacking layers and training.
- enable_adam(enable=True, beta1=0.9, beta2=0.999, epsilon=1e-08)[source]
Enables Adam optimizer with given hyperparameters.
- Parameters:
enable (bool) – Whether to use Adam.
beta1 (float) – Exponential decay rate for 1st moment.
beta2 (float) – Exponential decay rate for 2nd moment.
epsilon (float) – Small value to avoid division by zero.