MCPcopy Index your code
hub / github.com/apache/tvm / _check_for_tensor_struct_info

Method _check_for_tensor_struct_info

python/tvm/relax/expr.py:249–264  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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":

Callers 6

dtypeMethod · 0.95
ndimMethod · 0.95
shapeMethod · 0.95
stridesMethod · 0.95
byte_offsetMethod · 0.95
elem_offsetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected