Adding support for getting/setting tensor slices
Opened this issue · 0 comments
seanlatias commented
We should add support for the following features.
- Get a slice of a tensor and make a copy
A = hcl.placeholder((10,))
B = A[2:5].copy()
# equivalent API
B = hcl.compute((3,), lambda x: A[x+2])
- Set a slice of a tensor
A = hcl.placeholder((10,))
A[2:5] = [1, 2, 3]
A[2:5] = 4 # broadcast
- Get a slice of a tensor without making a copy
A = hcl.placeholder((10, 10))
B = A[2:5]
B[0] = 1
hcl.print(A[2]) # returns 1