User interface needs some updates
Context
Aidge user interface suffers from 3 type of issues that may be very armfull to the overall experience.
1. Inconsistencies
Inconsistencies make it hard to really know what exists and how to use it.
// cpp
dataType()
// python
dtype()
// two functions that return true with different naming conventions
empty();
isContiguous();
// some functions use get for getters, some don't
There should be a clear naming convention
2. Some variables are tricky to access
- Outputs of a Graphview
- If a name for a node was already used #296
- many functions not binded
- operator inputs/outputs from their names (myconv.i.weight) #293
3. flow of the interface
- Aidge uses a functional interfaces that might feel odd #295
- in-place operations are badly handled or non-existent #294
Suggested solution
Here is a table that summarises the syntax I propose to solve all these issues:
Category | C++ Method Form | Purpose / Behavior | Python Binding Equivalent | Notes |
---|---|---|---|---|
Getter | X() |
Returns internal attribute (e.g. dtype, backend) |
tensor.x (property, readonly if setX does not exist) |
Always a const method; no side effects |
Setter | setX(...) |
Manually set internal attribute |
tensor.x = value (property) |
Used only when user explicitly sets internals |
Functional op | toX(...) |
Returns new tensor with updated X | tensor.to_x(...) |
Non-mutating, allocates new storage |
In-place op | toX_(...) |
Modifies tensor in-place with new X | tensor.to_x_(...) |
No allocation; modifies internal state |
Boolean query | isX() |
Returns true/false for internal state (e.g. isContiguous() ) |
tensor.is_x (property) |
Predicate naming: always starts with is , returns bool
|
Edited by Maxence Naud