Version 7.5.0¶
This release introduces Neural Network diagrams as a new diagram type in the
BESSER Web Modeling Editor, letting users design neural network architectures
visually and generate PyTorch or TensorFlow code directly from the editor. The
NN metamodel now has a validate() method, and the documentation covering
neural network modeling and code generation has been expanded.
New Features and Improvements¶
Neural Network Diagram (Web Modeling Editor)
Added NNDiagram as a first-class diagram type with a dedicated palette covering layers (Conv1D, Conv2D, Conv3D, Pooling, SimpleRNN, LSTM, GRU, Linear, Flatten, Embedding, Dropout, LayerNorm, BatchNorm), tensor operations (concatenate, multiply, matmultiply, reshape, transpose, permute), Configuration, Training Dataset, and Test Dataset.
Added the Generate menu options for PyTorch and TensorFlow, each in Subclassing or Sequential form.
Added a backend processor that converts the editor JSON into
NNmetamodel instances. The processor callsNN.validate()before returning, so malformed diagrams surface as structured errors instead of trickling into the generators.Added a BUML-to-JSON converter that lets NN diagrams be re-imported into the editor after a BUML export, with full support for the explicit-default sidecar pattern (
permute_in,padding_type='valid',start_dim=1and similar) so round-tripping a project preserves user intent.Added NN dispatch to the
/get-json-modeland/generate-output-from-projectendpoints. The project endpoint resolves the required diagram type from the generator registry rather than branching on generator-name string literals, and PyTorch/TensorFlow share the same dispatch path as Qiskit.Documentation:
docs/source/web_editor.rst.
Neural Network Metamodel
Added
NN.validate()covering module-name uniqueness, layer and tensor-op cross-references, the first module being a valid entry point, sub-networks forming a non-cyclic graph (with each sub-network itself validated), Python-identifier safety on names, and numerical bounds on hyperparameters and layer sizes, plus warnings for inconsistencies between training and test datasets and for empty NNs.The validator follows the BESSER metamodel contract: errors are collected and returned in a
{"success", "errors", "warnings"}dict, only raising at the root call whenraise_exception=True. Sub-NN recursion is cycle-guarded.Python keywords on module names surface as warnings rather than errors, matching
NamedElement.name’s warn-not-error stance.Dataset.__init__now initializes its optional fields unconditionally, so aDatasetconstructed withoutinput_formatortask_typeno longer raisesAttributeErroron the corresponding getter.Documentation expanded with a Core Concepts section, a Validation section, and an Example Usage block.
Documentation:
docs/source/buml_language/model_types/nn.rst.
PyTorch and TensorFlow Generators
Both generators are conditionally registered: if the optional
torchortensorflowdependencies are not installed the corresponding generator is silently dropped from the supported list rather than breaking backend startup.Output filenames are deterministic per
generation_type(pytorch_nn_subclassing.py/pytorch_nn_sequential.py/tf_nn_subclassing.py/tf_nn_sequential.py) and centralized in a single helper, so router code no longer hard-codes the prefix.Documentation expanded: each generator page now describes its Parameters, Web Modeling Editor integration, and the structure of the generated file.
Documentation:
docs/source/generators/pytorch.rst,docs/source/generators/tensorflow.rst.
Code Quality and Hardening¶
This release also includes a multi-agent review pass on the NN backend with follow-up fixes:
Sanitized CR/LF in NN comment writes in
buml_code_builder/nn_model_builder.pyso user-controlled names (NN, sub-NN, layer titles) cannot break out of the surrounding# ...line in generated source. The generated file is laterexec()‘d, so this closes a code-injection vector via newline injection.Centralized JSON↔BUML symmetry: every layer type, tensor operation, and explicit-default sidecar handled in the JSON-to-BUML processor has a matching emitter in the BUML-to-JSON converter, with round-trip coverage in
test_converter_roundtrip.py.Replaced the hand-rolled
_PY_IDENT_REregex with the stdlibstr.isidentifier()check, removing a duplicate ofbuml_code_builder.common’s identifier helpers.Routed NN endpoint failures through the existing
ConversionError/GenerationErrorexception hierarchy and the@handle_endpoint_errorsdecorator, in line with the rest of the backend, so error responses are uniform.The
/get-json-modelis_projectfallback now surfacesNNDiagramandQuantumCircuitDiagramalongside the previously-supported diagram types, so single-NN or single-Quantum project files re-import correctly.