Raise an error if this is something other than a Tensor Used for early checks in `expr.dtype` and `expr.shape` accessors. While invalid usage would cause errors to be raised during shape inference, an earlier check makes it easier to find the invalid usage.
(self)
| 247 | raise |
| 248 | |
| 249 | def _check_for_tensor_struct_info(self): |
| 250 | """Raise an error if this is something other than a Tensor |
| 251 | |
| 252 | Used for early checks in `expr.dtype` and `expr.shape` |
| 253 | accessors. While invalid usage would cause errors to be |
| 254 | raised during shape inference, an earlier check makes it |
| 255 | easier to find the invalid usage. |
| 256 | """ |
| 257 | if self.struct_info_ is None: |
| 258 | return |
| 259 | |
| 260 | if not isinstance(self.struct_info_, tvm.relax.TensorStructInfo): |
| 261 | raise TypeError( |
| 262 | f"Runtime unpacking of DLDataType is only implemented for tensors, " |
| 263 | f"but was applied to object {self} of type {type(self)}." |
| 264 | ) |
| 265 | |
| 266 | @property |
| 267 | def dtype(self) -> "_DLTensorDTypeProxy": |
no outgoing calls
no test coverage detected