qewton.algorithms package¶
Module contents¶
Algorithms Submodule¶
The algorithms module contains the library of computational building blocks used to construct models. It provides standardized implementations of mathematical, statistical, and neural operations. Is also planned to include more complex algorithms such as Fourier Neural Operators, PCA-Nets, DeepONets, PDE solvers and more.s
Key Components¶
Building Blocks:Math: Basic functions.
Matrix Operations: MatMul, SVD, and linear algebra.
Statistics: Reduction operations like Mean, Sum, and Std with support for keep-dims logic.
Reshaping: Flatten, Transpose, and Slicing operations.
Goals¶
Portability: Write a model once (using the building blocks) and run it on any supported backend. Same operations across all frameworks.
Extensibility: Provide a clear template for users to wrap their own custom operations or library functions.
Efficiency: Use fast implementations of backends but combine them in a user-friendly way.
Implementation Strategy¶
Subclasses of Node typically implement a forward method that delegates to self.implementation. This allows for a default implementation while providing hooks for framework-specific optimizations when needed. At execution time, the graph will call forward, which will use the correct implementation based on the active backend.
Writing a node¶
Declare the configuration of every port in the annotations of
forward; use one object (e.g. anEllipsisAxes) in several annotations for axes the node passes through.Implement
relateonly if the node changes dims by their index (seeqewton.config).Make sizes that fix how the node is built
HyperParameters and bind the dims of the ports to them (AxesDim(hp)); accept None for input sizes inferred from the data (HyperParameter.size_from).Create weights in
build();setup()belongs to the library and must not be overridden.
Subpackages¶
- qewton.algorithms.building_blocks package
- Module contents
- Submodules
- qewton.algorithms.building_blocks.activation_functions module
- qewton.algorithms.building_blocks.array_operations module
- qewton.algorithms.building_blocks.channel_mlp module
- qewton.algorithms.building_blocks.conv module
- qewton.algorithms.building_blocks.creation module
- qewton.algorithms.building_blocks.derivatives module
- qewton.algorithms.building_blocks.embeddings module
- qewton.algorithms.building_blocks.fno_block module
- qewton.algorithms.building_blocks.geometry module
- qewton.algorithms.building_blocks.linear module
- qewton.algorithms.building_blocks.math module
- qewton.algorithms.building_blocks.norms module
- qewton.algorithms.building_blocks.parameters module
ParameterNodeParameterNode.build()ParameterNode.set_trainable_parameter()ParameterNode.output_config()ParameterNode.run()ParameterNode.forward()ParameterNode.reset()ParameterNode.fix_node_state()ParameterNode.set_state()ParameterNode.trainable_parametersParameterNode.memory_consumptionParameterNode.to()
- qewton.algorithms.building_blocks.skip_connections module
- qewton.algorithms.building_blocks.spectral_convolution module