(input: Tensor, lower: int, upper: int)
| 789 | |
| 790 | |
| 791 | def int_clip(input: Tensor, lower: int, upper: int) -> Tensor: |
| 792 | assert lower <= upper, f"Lower bound must be less than or equal to upper bound i.e. {lower} <= {upper}" |
| 793 | res = minimum(input, upper) |
| 794 | res = maximum(res, lower) |
| 795 | return res |
| 796 | |
| 797 | |
| 798 | def clip(input: Tensor, alpha: float, beta: float) -> Tensor: |