Scale all shape dimensions by a factor, rounding to nearest integer. Ensures all values are at least 1.
(shape: Dict[str, int], factor: float)
| 213 | |
| 214 | |
| 215 | def scale_shape(shape: Dict[str, int], factor: float) -> Dict[str, int]: |
| 216 | """ |
| 217 | Scale all shape dimensions by a factor, rounding to nearest integer. |
| 218 | Ensures all values are at least 1. |
| 219 | """ |
| 220 | return {k: max(1, int(round(v * factor))) for k, v in shape.items()} |
| 221 | |
| 222 | |
| 223 | def get_default_shape(op_type: str) -> Dict[str, int]: |
no outgoing calls
no test coverage detected