Matlab/Pytorch/Numpy syntax for multidimensional array indexing and slicing #21628
Labels
Feature Request
This issue is made to request a feature.
Type: Specification
Everything related to the formal specification of how V should behave
Type: Syntax
The issue/PR is related to the V syntax
Describe the feature
A way to emulate multidimensonal array indexing and slicing like matlab, pytorch or numpy. This will allow egineering, statistics, machine learning, deep learning and other numerical work to be performed in a compact and readable way, making it more accessible.
Currently VLT is supposed to be the ongoing work on this regard already planned.
I find the way
tensors
are sliced to be really cumbersome, hard to understand, with unnecessary boilerplate code. I believe this problem stems fromV
language syntax limitations.Use Case
For instance, taken form vlt
The code
Could be converted into:
Another example, the code from vlt:
The code:
Could be converted into:
Another example, the code from vlt:
The code:
Could be converted into:
Proposed Solution
Add additional syntax to
V
language to allow indexing and silicng of multidimensional arrays that have been widely successful in multiple languages and frameworks for decades ( matlab, numpy ) and are the cornerstone for deep learning and other highly desirable numerical computing workflows.V
already has support for syntax sugar for unidimensional arrays. A multidimensionaltensor
could have similar syntax sugar. For instance:The syntax shall allow expressions like:
Potentially, the langauge should allow the implementaiton of these operations to be performed by different devices ( CPU, GPU).
This also means it is likely out of bounds to be disabled or at least disabled by default if that allows better preformance.
Other Information
No response
Acknowledgements
Version used
0.4.6
Environment details (OS name and version, etc.)
Linux Ubuntu 22.04.1
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: