(width, multiplier, min_width=1, divisor=1, verbose=False)
| 8 | |
| 9 | |
| 10 | def round_width(width, multiplier, min_width=1, divisor=1, verbose=False): |
| 11 | if not multiplier: |
| 12 | return width |
| 13 | width *= multiplier |
| 14 | min_width = min_width or divisor |
| 15 | if verbose: |
| 16 | logger.info(f"min width {min_width}") |
| 17 | logger.info(f"width {width} divisor {divisor}") |
| 18 | logger.info(f"other {int(width + divisor / 2) // divisor * divisor}") |
| 19 | |
| 20 | width_out = max(min_width, int(width + divisor / 2) // divisor * divisor) |
| 21 | if width_out < 0.9 * width: |
| 22 | width_out += divisor |
| 23 | return int(width_out) |
| 24 | |
| 25 | |
| 26 | def validate_checkpoint_wrapper_import(checkpoint_wrapper): |
no outgoing calls
no test coverage detected