Conversation
There was a problem hiding this comment.
Great feature, the NN editor looks solid overall. Some things to address before merge:
NNElementRegistry concerns
The singleton registry tracks container/config IDs but never cleans up when elements are deleted. The FIFO eviction at 100 entries doesn't guarantee correctness. Since this duplicates what Redux already knows (element types are in state.elements), consider querying the store directly instead.
Dead code
renderOldPanel() in nn-association-update.tsx is explicitly marked "unused but kept for reference" — should be removed before merge along with its associated onChange/onUpdate handlers.
Input validation
Numeric attributes (epochs, learning_rate, hidden_size, batch_size, etc.) accept any string through <Textfield> with no validation. Invalid values will propagate to the backend and produce broken PyTorch/TensorFlow code. Add type="number" or validate on change.
Smaller things
NNRelationshipTypere-exports allClass*relationship types — the NN enum should only defineNNNextandNNComposition- Throwing plain strings in
nn-unidirectional.ts(throw 'NNNext cannot connect...') instead ofErrorobjects — loses stack traces - No-op bounds assignment in
nn-preview.ts(spreads then overwrites with same values) - Various
as anycasts that could be properly typed OptionalAttributeRowat 618 lines could use a config-driven approach instead of string matching for each attribute type
Replace NNElementRegistry singleton with direct Redux state queries (NNCompositionComponent, NNNext) Remove nn-association-update.tsx including renderOldPanel() dead code Validation for int/float/List attribute types Remove Class* entries from NNRelationshipType (keep only NNNext, NNComposition) Remove throw string literals in NNNext constructor. validation moved to NNAssociationMonitor Remove no-op bounds assignments and unused imports in nn-preview.ts Eliminate as any casts: add INNAttribute interface, type UMLClass.supportedRelationships as UMLRelationshipType, use PreviewElement for .styles Refactor OptionalAttributeRow to config-driven widget lookup via nn-attribute-widget-config.ts Remove dead code: nn-association-wrapper.tsx, unreachable isNNLayer logic in monitor Auto-increment layer and container names on drop to avoid duplicate names in code generation
|
Comments addressed: NNElementRegistry: Removed NNElementRegistry. Now NNCompositionComponent reads element types directly from Redux state; NNNext constructor no longer validates connections; NNAssociationMonitor reactively deletes invalid NNNext connections instead. Dead code: Deleted nn-association-update.tsx including renderOldPanel() and all associated handlers. Input validation: Validation for int, float, and List types is implemented, covering all numeric inputs. Smaller things |
…BESSER-Web-Modeling-Editor into feature/nn-diagram
Neural Network Diagram Editor & Code Generation
This release introduces the Neural Network (NN) Diagram Editor, a visual drag-and-drop interface
for designing neural network architectures directly in the BESSER Web Modeling Editor, along with
PyTorch and TensorFlow code generation capabilities.
New Features and Improvements
Neural Network Diagram Editor
NNDiagramalongside existing UML diagram types.Code Generation
pytorchandtensorflowas new generator types.