Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions backends/cadence/utils/facto_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ def random_size_constraint(deps: object, r: int, d: int) -> int:
cp.Value.Le(lambda deps, dtype, struct: 2**2),
cp.Size.Le(lambda deps, r, d: 2**3),
]
case "leaky_relu.default":
tensor_constraints.extend(
[
cp.Dtype.In(lambda deps: [torch.float32]),
]
)
case "_softmax.default":
tensor_constraints.extend(
[
Expand Down Expand Up @@ -444,6 +450,14 @@ def facto_testcase_gen( # noqa: C901
spec.inspec[index].constraints.extend(
[cp.Value.Ge(lambda deps, _: deps[1])]
)
elif in_spec.name == "negative_slope" and op_name == "leaky_relu.default":
# For leaky_relu, negative_slope should be in typical range (0, 1]
spec.inspec[index].constraints.extend(
[
cp.Value.Gt(lambda deps, dtype: 0),
cp.Value.Le(lambda deps, dtype: 1.0),
]
)
else:
spec.inspec[index].constraints.extend(
[
Expand Down
Loading