MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / scale_shape

Function scale_shape

extract.py:215–220  ·  view source on GitHub ↗

Scale all shape dimensions by a factor, rounding to nearest integer. Ensures all values are at least 1.

(shape: Dict[str, int], factor: float)

Source from the content-addressed store, hash-verified

213
214
215def 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
223def get_default_shape(op_type: str) -> Dict[str, int]:

Callers 1

generate_kernel_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected