You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/03/10 03:07:55 UTC
[GitHub] [tvm] leeexyz commented on pull request #10546: [TE] Bind a rank-0 tensor in `decl_tensor_intrin`
leeexyz commented on pull request #10546:
URL: https://github.com/apache/tvm/pull/10546#issuecomment-1063605989
> I'm not sure. Can you explain why "comparison among rank-0 tensor is ambiguous"?
I guess [here](https://github.com/apache/tvm/blob/main/python/tvm/te/tensor.py#L89-L95), the `tensor.equal(other)` and `tensor.same_as(other)` is not suitable for non rank-0 tensors, so it adds the check.
1. Reference check makes no sense because the address of the tensor is changed every time when invoking `op.output(id)`.
2. Content checks have some constraints, such as **Tensor dimension** needs to be matched.
All these two ways cannot be put into the `__eq__` method. But they may make sense for rank-0 tensors. A possible fix for this would be simply to delete [it](https://github.com/apache/tvm/blob/main/python/tvm/te/tensor.py#L89-L95).
```python
def __eq__(self, other):
if not isinstance(other, Tensor):
if isinstance(other, _expr.ExprOp):
return _expr.EqualOp(self, other)
return False
return _ffi_api.TensorEqual(self, other)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org