cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
326 stars 92 forks source link

[API] Add "shape" property to tensor slice #369

Closed seanlatias closed 3 years ago

seanlatias commented 3 years ago

Currently, we only allow users to access the shape property of a tensor. In this PR, we extend the use of shape to a tensor slice. We follow the same semantic as NumPy. For example,

A = hcl.placeholder((2, 3, 4))
A.shape           # (2, 3, 4)
A[0].shape        # (3, 4)
A[0][1].shape     # (4,)
A[0][1][2].shape  # ()