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
| 682 | |
| 683 | @tvm_ffi.register_object("relax.expr.ShapeExpr") |
| 684 | class 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 | |
| 715 | def make_shape(shape: list[Any] | tuple[Any, ...]) -> ShapeExpr: |
no outgoing calls
no test coverage detected
searching dependent graphs…