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

Method as_struct_info

python/tvm/relax/script/parser/entry.py:234–254  ·  view source on GitHub ↗
(self, dict_globals: dict[str, Any] | None = None)

Source from the content-addressed store, hash-verified

232 return {s for s in self.shape if isinstance(s, str) and s.isidentifier()}
233
234 def as_struct_info(self, dict_globals: dict[str, Any] | None = None) -> TensorStructInfo:
235 vdev = self.vdevice
236 if isinstance(self.vdevice, str):
237 if ":" in self.vdevice:
238 split_vdev = self.vdevice.split(":")
239 vdev = lookup_vdevice(split_vdev[0], int(split_vdev[1]))
240 else:
241 vdev = lookup_vdevice(self.vdevice, 0)
242
243 if self.shape is None:
244 return TensorStructInfo(None, self.dtype, vdev, self.ndim)
245 elif isinstance(self.shape, ShapeExpr | Var):
246 return TensorStructInfo(self.shape, self.dtype, vdev, self.ndim)
247 else:
248 if dict_globals is None and any([isinstance(s, str) for s in self.shape]):
249 raise ValueError(
250 "String-defined shape expr is only allowed when parsing function parameters "
251 "and return annotations for TVMScript."
252 )
253 shape = [_eval_shape(s, dict_globals) for s in self.shape]
254 return TensorStructInfo(shape, self.dtype, vdev, self.ndim)
255
256
257def Tensor(

Callers

nothing calls this directly

Calls 5

lookup_vdeviceFunction · 0.90
TensorStructInfoClass · 0.90
_eval_shapeFunction · 0.85
anyFunction · 0.50
splitMethod · 0.45

Tested by

no test coverage detected