API Reference (Release 1.0.0)
Complete documentation for all modules, classes, and methods supported in AMEVA-Forge Release 1.0.
1. Core Tensor (forge.Tensor)
| Method / Attribute |
Description |
forge.tensor(data, requires_grad=False, device='cpu') |
Creates a new multi-dimensional tensor from array or nested lists. |
tensor.to(device) / tensor.move_to_(device) |
Transfers tensor storage between CPU and WebGPU in-place preserving parameter identity. |
tensor.backward(gradient=None) |
Computes vector-Jacobian products (VJP) across the autograd graph. |
await tensor.numpy_async() |
Asynchronously reads back GPU buffer to NumPy array without blocking browser UI. |
2. Neural Network Modules (forge.nn)
| Module |
Description |
nn.Linear(in_features, out_features, bias=True) |
Applies an affine linear transformation \(y = xA^T + b\). |
nn.LayerNorm(normalized_shape, eps=1e-5) |
Applies Layer Normalization over the specified normalized shape. |
nn.BatchNorm2d(num_features, eps=1e-5, momentum=0.1) |
Applies 2D Batch Normalization with train/eval state tracking. |
nn.PositionalEncoding(d_model, max_len=5000) |
Sinusoidal positional encoding with LRU dynamic caching. |
nn.Dropout(p=0.5) |
Applies randomized zeroing during training mode; identity during eval. |
nn.Sequential(*layers) |
Sequential container for chaining neural network modules. |
3. Functional & Loss Operations (forge.functional)
| Function |
Description |
F.scaled_dot_product_attention(q, k, v, is_causal=False) |
Computes attention \(\text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V\) with optional causal masking. |
F.cross_entropy(input, target) |
Computes Cross-Entropy loss with mathematically exact closed-form GPU derivative. |
F.softmax(input, dim=-1) |
Applies numerically stabilized softmax along the specified dimension. |
nn.MSELoss() |
Measures mean squared error between prediction and ground truth. |
4. Optimizers (forge.optim)
| Optimizer |
Description |
optim.SGD(params, lr=0.01, momentum=0.0) |
Stochastic Gradient Descent optimizer supporting asynchronous WebGPU in-place AXPY kernel updates. |