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

Method has_shape

python/tvm/relax/dpl/pattern.py:145–166  ·  view source on GitHub ↗

Add a shape constraint to this pattern Parameters ---------- shape: List[PrimExpr] Expected shape list Returns ------- result: ShapePattern The resulting ShapePattern Note ---- has_shape assum

(self, shape: list[PrimExpr])

Source from the content-addressed store, hash-verified

143 return has_dtype(dtype, self)
144
145 def has_shape(self, shape: list[PrimExpr]) -> "ShapePattern":
146 """
147 Add a shape constraint to this pattern
148
149 Parameters
150 ----------
151 shape: List[PrimExpr]
152 Expected shape list
153
154 Returns
155 -------
156 result: ShapePattern
157 The resulting ShapePattern
158
159 Note
160 ----
161 has_shape assumes that the matched relax.Expr only has one
162 output tensor. Use is_tuple for those with multiple outputs.
163 """
164 if not isinstance(shape, list | tuple | tvm.ir.PrimExpr):
165 raise ValueError("has_shape takes a list or tuple as input.")
166 return ShapePattern(pattern=self, shape=shape)
167
168 def match(self, expr, var2val: dict[Var, Expr] | None = None) -> bool:
169 """

Callers 6

test_and_patternFunction · 0.80
test_not_patternFunction · 0.80
test_shape_patternFunction · 0.80
test_two_matmulFunction · 0.80
test_concat_mm_splitFunction · 0.80

Calls 1

ShapePatternClass · 0.85

Tested by 5

test_and_patternFunction · 0.64
test_not_patternFunction · 0.64
test_shape_patternFunction · 0.64
test_two_matmulFunction · 0.64
test_concat_mm_splitFunction · 0.64