Add feature: Added support for getting and setting tensor slices
How to use the new feature:
Copy a slice of a tensor
A = hcl.placeholder((10,))
B = hcl.copy(A[2:5])
# equivalent API
B = hcl.compute((3,), lambda x: A[x+2])
Set a slice of a tensor
A = hcl.placeholder((10,))
B = hcl.placeholder((15,))
A[2:5] =B[4:7]
A[2:5] = 4 # broadcast
3. 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
**Description:** Most of the changes were in tensor.py where additional logic had to be added to handle slices in the list of indices. In the TensorSlice class, indices immediately following one or more slice had to be shifted so that the correct element would be accessed (as demonstrated in the third example). get_index in util.py also had to be modified to return the correct index when a slice of a tensor was being set.
**Link to the tests:** The tests are in heterocl/tests/test_dsl_tensorslice.py
Add feature: Added support for getting and setting tensor slices
How to use the new feature:
Copy a slice of a tensor
Set a slice of a tensor
A = hcl.placeholder((10, 10)) B = A[2:5] B[0] = 1 hcl.print(A[2]) # returns 1