You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have read the roadmap and priorities and I believe this request falls within the priorities.
What is your request?
Slicing tensors to assign new variables is not intuitive right now. Both Golang and Python use the same indexing and another modern language like Mojo should as well, especially if the aim is to lower the barrier to entry for new users.
## I think this is the easiest way? Even the official docs show a## similar method to assign a numpy array from a Tensor## calling numpy_array.itemset((col, row), tensor[col, row])vart= Tensor[DType.float64](
(3, 1),
-1,
0,
1,
0
)
varx: Tensor[DType.float64] = Tensor[DType.float64](2, 1)
vary: Tensor[DType.float64] = Tensor[DType.float64](2, 1)
for i inrange(4):
if i <2:
x[i] = t[i, 0]
else:
y[i] = t[i, 0]
print(x)
$ mojo run test.mojo
Tensor([[-1.0],
[0.0]], dtype=float64, shape=2x1)
What is your motivation for this change?
Following the examples and documentation I see syntax that is very nearly Python and I would expect the Tensor type to behave like tensors in Python as well.
Any other details?
A first cut could be a middle ground between what's possible now and how Golang and Python achieve this where the user still has to preallocate the memory but is able to assign using slice indices
Review Mojo's priorities
What is your request?
Slicing tensors to assign new variables is not intuitive right now. Both Golang and Python use the same indexing and another modern language like Mojo should as well, especially if the aim is to lower the barrier to entry for new users.
What is your motivation for this change?
Following the examples and documentation I see syntax that is very nearly Python and I would expect the
Tensor
type to behave like tensors in Python as well.Any other details?
A first cut could be a middle ground between what's possible now and how Golang and Python achieve this where the user still has to preallocate the memory but is able to assign using slice indices
A logical next iteration might relieve the user of having to call
Index
The holy grail would be something akin to Python's default behavior, Golang's
:=
, and C++'sauto
where the memory allocation is handled on the fly.The text was updated successfully, but these errors were encountered: