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

TensorSlice doesn't have `shape` property #368

Closed zhenkun closed 3 years ago

zhenkun commented 3 years ago

A = hcl.compute((2,10), lambda i,j: 0) A[1].shape

will result in this: _Error in sys.excepthook: Traceback (most recent call last): File ".../heterocl-0.1-py3.7.egg/heterocl/debug.py", line 70, in hcl_excepthook print("\33[1;34m[HeteroCL Error]\33[0m" + value.message) AttributeError: 'TensorError' object has no attribute 'message'

Original exception was: Traceback (most recent call last): File "", line 1, in File ".../heterocl-0.1-py3.7.egg/heterocl/tensor.py", line 164, in getattr "Cannot access attribute if type is not struct") heterocl.debug.TensorError: [Tensor] Cannot access attribute if type is not struct_

seanlatias commented 3 years ago

I will add this property but note that a slice of tensor cannot be used alone. In other words, you cannot write something like A[0]+A[1].

seanlatias commented 3 years ago

@zhenkun please check #369 and see if that fixes your issue. Thanks!

zhenkun commented 3 years ago

@seanlatias , thanks for the quick update! I will try it, and let you know.

zhenkun commented 3 years ago

works now! Thanks.