We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 770cf3d commit 961a187Copy full SHA for 961a187
backends/cadence/utils/facto_util.py
@@ -344,14 +344,23 @@ def random_size_constraint(deps: object, r: int, d: int) -> int:
344
]
345
)
346
case "div.Tensor":
347
- tensor_constraints.extend(
348
- [
349
- cp.Value.Ne(lambda deps, dtype, struct: 0),
350
- cp.Value.Le(lambda deps, dtype, struct: 2**3),
351
- cp.Size.Le(lambda deps, r, d: 2**3),
352
- cp.Rank.Le(lambda deps: 2**2),
353
- ]
354
- )
+ if index == 1: # Only apply zero-prevention to divisor
+ tensor_constraints.extend(
+ [
+ cp.Value.Ne(lambda deps, dtype, struct: 0), # Prevent division by zero
+ cp.Value.Le(lambda deps, dtype, struct: 2**3),
+ cp.Size.Le(lambda deps, r, d: 2**3),
+ cp.Rank.Le(lambda deps: 2**2),
+ ]
355
+ )
356
+ else:
357
358
359
360
361
362
363
364
case "pow.Tensor_Scalar":
365
tensor_constraints.extend(
366
[
0 commit comments