MCPcopy Create free account
hub / github.com/apache/tvm / ShapeExpr

Class ShapeExpr

python/tvm/relax/expr.py:684–712  ·  view source on GitHub ↗

A shape expression which allows users to construct a shape containing PrimExpr. Parameters ---------- values: Union[List[PrimExpr], typing.Tuple[PrimExpr, ...], tvm_ffi.Array] The values of the shape expression. span: Optional[Span] Span that points to original sour

Source from the content-addressed store, hash-verified

682
683@tvm_ffi.register_object("relax.expr.ShapeExpr")
684class ShapeExpr(ExprWithOp):
685 """A shape expression which allows users to construct a shape containing PrimExpr.
686
687 Parameters
688 ----------
689 values: Union[List[PrimExpr], typing.Tuple[PrimExpr, ...], tvm_ffi.Array]
690 The values of the shape expression.
691
692 span: Optional[Span]
693 Span that points to original source code
694 """
695
696 values: list[PrimExpr]
697 span: Span | None
698
699 def __init__(
700 self,
701 values: list[PrimExpr] | tuple[PrimExpr, ...] | tvm_ffi.Array,
702 span: Span | None = None,
703 ) -> None:
704 self.__init_handle_by_constructor__(_ffi_api.ShapeExpr, values, span) # type: ignore
705
706 def __getitem__(self, index):
707 if index >= len(self) or index < -len(self):
708 raise IndexError("ShapeExpr index out of range")
709 return self.values[index]
710
711 def __len__(self):
712 return len(self.values)
713
714
715def make_shape(shape: list[Any] | tuple[Any, ...]) -> ShapeExpr:

Callers 15

call_tirFunction · 0.90
make_shapeFunction · 0.85
_shape_with_old_tir_varFunction · 0.85
__init__Method · 0.85
onesFunction · 0.85
zerosFunction · 0.85
broadcast_toFunction · 0.85
collapse_sum_toFunction · 0.85
call_tirFunction · 0.85
call_tir_with_gradFunction · 0.85
call_tir_inplaceFunction · 0.85
resize2dFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…