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
27 changes: 19 additions & 8 deletions backends/cadence/utils/facto_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,25 @@ def random_size_constraint(deps: object, r: int, d: int) -> int:
]
)
case "div.Tensor":
tensor_constraints.extend(
[
cp.Value.Ne(lambda deps, dtype, struct: 0),
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),
]
)
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),
]
)
else:
tensor_constraints.extend(
[
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),
]
)
case "pow.Tensor_Scalar":
tensor_constraints.extend(
[
Expand Down
Loading