Closed zzzDavid closed 2 years ago
I do not get the point here. hcl.Tensor
is just a wrapper of hcl_mlir.TensorOp
. All the operations are overloaded in hcl_mlir.TensorOp
. I think users should use .v
to access the actual value in hcl.scalar
.
I remember there was a confusion about whether to use scalar.v
or just scalar
with the old HCL. I think we can enforce using .v
in the new version, so we won't need to add operations in the Tensor wrapper
Right. Users should explicitly distinguish scalar and tensor by using .v
.
Adding arithmetic operations to Tensor seems like weird choice. But we need to support arithmetic and comparison operations on
hcl.scalar
. For example:hcl.scalar
is ahcl.mlir.tensor.Tensor
object, but it should act like a scalar value.My thoughts are that we could add operations like
__add__
,__eq__
tohcl.mlir.tensor.Tensor
class. @chhzh123 What do you think?