As best I can tell there is no direct way to assign a slice of a tensor to a new variable. I am looking for something Python-esque like
fn blah(): var t = Tensor[DType.float64]( (3, 1), -1, 0, 1, ) var x = t[Index(0:2)] print(x)
fn blah(): var t = Tensor[DType.float64]( (3, 1), -1, 0, 1, ) var x = t[Index(0:2)] print(x)
But even the official docs show
for
for
loops iterating over a Tensor to populate a new array. Is there a better way to achieve this? It becomes more of an issue with a larger Tensor where I want to assign multiple variables to different slices.