Skip to content

Commit 961a187

Browse files
author
Zonglin Peng
committed
[Jarvis][Nightly] address zero division jarvis-nightly-operators-test-aten-div-out
https://docs.google.com/spreadsheets/d/12DsKcvPcGgxnZ8shgn6j8PmoOQUfy5GgUg974g1iO18/edit?gid=0#gid=0 Differential Revision: [D85364549](https://our.internmc.facebook.com/intern/diff/D85364549/) [ghstack-poisoned]
1 parent 770cf3d commit 961a187

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

backends/cadence/utils/facto_util.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,23 @@ def random_size_constraint(deps: object, r: int, d: int) -> int:
344344
]
345345
)
346346
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-
)
347+
if index == 1: # Only apply zero-prevention to divisor
348+
tensor_constraints.extend(
349+
[
350+
cp.Value.Ne(lambda deps, dtype, struct: 0), # Prevent division by zero
351+
cp.Value.Le(lambda deps, dtype, struct: 2**3),
352+
cp.Size.Le(lambda deps, r, d: 2**3),
353+
cp.Rank.Le(lambda deps: 2**2),
354+
]
355+
)
356+
else:
357+
tensor_constraints.extend(
358+
[
359+
cp.Value.Le(lambda deps, dtype, struct: 2**3),
360+
cp.Size.Le(lambda deps, r, d: 2**3),
361+
cp.Rank.Le(lambda deps: 2**2),
362+
]
363+
)
355364
case "pow.Tensor_Scalar":
356365
tensor_constraints.extend(
357366
[

0 commit comments

Comments
 (0)