You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have questions about stdlib? Need help fixing a bug, figuring out what to do next, or just looking for feedback? Join our weekly office hours to connect with project maintainers, stay updated on the latest project news, and chat with other community members. This is a great opportunity to ask questions, share ideas, and engage directly with the stdlib team.
Loss functions update: Synced with nakul and opened initial forward-pass PRs (e.g. squared-error) matching the existing gradient architecture.
Float32 ML pipeline scoping: Audited missing float32 packages across the monorepo; proposing a scoped tracking issue for ML loss & activation primitives while scoping out the Remez/minimax math backlog.
GELU & SiLU proposals: Finalizing namespace and numerical stability designs (erfc formulation, gelu.tanh, gelu.quick, and math/base/special/silu).
These notes are likely imperfect, especially when it comes to spelling/function/package names
Meeting Purpose
Review open PRs and align on API design and implementation strategy.
Key Takeaways
FFT PR #16089 requires a full refactor. The current implementation is 1D-only and inefficient, using manual buffer manipulation instead of the ndarray API's batching and optimized kernels.
Scalar parameters for native C implementations must be typed. To ensure safe, direct calls to native code, scalar parameters like k in ndarray-ctril must be explicitly typed as Int32Array, not ndarray-generic.
GELU approximations will be split into separate packages. To maintain a clean API, specialized approximations (tanh, quik) will live in their own packages (e.g., gelu-tanh) within the mathbase-special/fast namespace.
FFT API naming will be standardized. The API will use FFT for complex and RFFT for real transforms, with IFFT and IRFFT for inverses, replacing the ambiguous F (forward) and B (backward) suffixes.
Topics
FFT Implementation Refactor (PR #16089)
Problem: The current implementation is 1D-only and uses manual buffer manipulation, which is inefficient and prevents batch processing over multi-dimensional arrays.
Solution: Refactor the PR to use the ndarray API as a "recipe" for stitching together operations. This leverages optimized kernels for batching and avoids manual loops.
Refactor Steps:
Workspace: Allocate a 1D workspace array, then broadcast its batch dimensions to match the input array.
Input Copy: Use ndarray-base/assign to copy the input data into a slice of the output array.
Computation: Pass the reinterpreted output array and the broadcasted workspace array to the base.js kernel.
Post-processing: Use ndarray operations (assign, fill, scale) for cleanup (e.g., zeroing imaginary components).
Blocker: The ndarray-base/scale package is needed for post-processing. Athan will review the existing PR for it to unblock this work.
FFT API Naming Standardization
Problem: The current F (forward) and B (backward) suffixes are ambiguous and inconsistent with common conventions.
Decision: Standardize on explicit names for clarity.
Complex:FFT (forward), IFFT (inverse)
Real:RFFT (forward), IRFFT (inverse)
Rationale: This aligns with conventions in libraries like MATLAB and Julia.
Documentation: The PR description will summarize this decision and its rationale. A formal mapping will be added to the NumPy migration guide later.
Handling Scalar Parameters in Native C Implementations
Problem: For native C implementations, passing a generic ndarray for a scalar parameter (e.g., k in ndarray-ctril) is unsafe and requires inefficient casting.
Solution: Explicitly type scalar parameter arrays as Int32Array (or another appropriate integer type).
Rationale: This allows for direct, safe calls to native C functions without casting, improving performance and reliability.
Action: Yug will implement this fix for ndarray-ctril. Ujjwal will then help propagate the pattern to other affected PRs.
GELU Package Structure
Problem: Multiple GELU approximations were planned for a single package, which creates an unclear API.
Decision: Split approximations into separate, named packages.
Base:gelu (textbook formula)
Approximations:gelu-tanh, gelu-quik (using the canonical quik name from VLLM/Mojo)
Location: These approximation packages will reside in the mathbase-special/fast sub-namespace to signal their performance-optimized nature, which may involve reduced accuracy.
Activity
kgryte commentedon Oct 12, 2026
This week's office hours will be held two hours earlier than usual, and I have updated the OP above accordingly.
AryanSharma48 commentedon Oct 13, 2026
A few discussion points from my side:
squared-error) matching the existing gradient architecture.float32packages across the monorepo; proposing a scoped tracking issue for ML loss & activation primitives while scoping out the Remez/minimax math backlog.erfcformulation,gelu.tanh,gelu.quick, andmath/base/special/silu).Erennn7 commentedon Oct 13, 2026
PR review on the C implementation for #16105
batpigandme commentedon Oct 13, 2026
AI-Generated Summary
Caution
These notes are likely imperfect, especially when it comes to spelling/function/package names
Meeting Purpose
Review open PRs and align on API design and implementation strategy.
Key Takeaways
ndarrayAPI's batching and optimized kernels.kinndarray-ctrilmust be explicitly typed asInt32Array, notndarray-generic.tanh,quik) will live in their own packages (e.g.,gelu-tanh) within themathbase-special/fastnamespace.FFTfor complex andRFFTfor real transforms, withIFFTandIRFFTfor inverses, replacing the ambiguousF(forward) andB(backward) suffixes.Topics
FFT Implementation Refactor (PR #16089)
ndarrayAPI as a "recipe" for stitching together operations. This leverages optimized kernels for batching and avoids manual loops.ndarray-base/assignto copy the input data into a slice of the output array.base.jskernel.ndarrayoperations (assign,fill,scale) for cleanup (e.g., zeroing imaginary components).ndarray-base/scalepackage is needed for post-processing. Athan will review the existing PR for it to unblock this work.FFT API Naming Standardization
F(forward) andB(backward) suffixes are ambiguous and inconsistent with common conventions.FFT(forward),IFFT(inverse)RFFT(forward),IRFFT(inverse)Handling Scalar Parameters in Native C Implementations
ndarrayfor a scalar parameter (e.g.,kinndarray-ctril) is unsafe and requires inefficient casting.Int32Array(or another appropriate integer type).ndarray-ctril. Ujjwal will then help propagate the pattern to other affected PRs.GELU Package Structure
gelu(textbook formula)gelu-tanh,gelu-quik(using the canonicalquikname from VLLM/Mojo)mathbase-special/fastsub-namespace to signal their performance-optimized nature, which may involve reduced accuracy.Full transcript
Full office hours transcript