Skip to content

Commit bf6ee5d

Browse files
authored
[Jarvis][Nightly] address error in jarvis-nightly-operators-test-aten-leaky-relu-out
Differential Revision: D85364558 Pull Request resolved: #15495
1 parent f5695fa commit bf6ee5d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

backends/cadence/utils/facto_util.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ def random_size_constraint(deps: object, r: int, d: int) -> int:
392392
cp.Value.Le(lambda deps, dtype, struct: 2**2),
393393
cp.Size.Le(lambda deps, r, d: 2**3),
394394
]
395+
case "leaky_relu.default":
396+
tensor_constraints.extend(
397+
[
398+
cp.Dtype.In(lambda deps: [torch.float32]),
399+
]
400+
)
395401
case "_softmax.default":
396402
tensor_constraints.extend(
397403
[
@@ -444,6 +450,14 @@ def facto_testcase_gen( # noqa: C901
444450
spec.inspec[index].constraints.extend(
445451
[cp.Value.Ge(lambda deps, _: deps[1])]
446452
)
453+
elif in_spec.name == "negative_slope" and op_name == "leaky_relu.default":
454+
# For leaky_relu, negative_slope should be in typical range (0, 1]
455+
spec.inspec[index].constraints.extend(
456+
[
457+
cp.Value.Gt(lambda deps, dtype: 0),
458+
cp.Value.Le(lambda deps, dtype: 1.0),
459+
]
460+
)
447461
else:
448462
spec.inspec[index].constraints.extend(
449463
[

0 commit comments

Comments
 (0)