MCPcopy Create free account
hub / github.com/Robbyant/lingbot-map / patch_align

Function patch_align

scripts/benchmark_gct_memory.py:110–117  ·  view source on GitHub ↗
(value: int, patch: int, mode: str)

Source from the content-addressed store, hash-verified

108
109
110def patch_align(value: int, patch: int, mode: str) -> int:
111 if value % patch == 0:
112 return value
113 if mode == "error":
114 raise ValueError(f"{value} is not divisible by patch size {patch}")
115 if mode == "floor":
116 return (value // patch) * patch
117 return ((value + patch - 1) // patch) * patch
118
119
120def resolve_dtype(device: str, dtype: str) -> torch.dtype:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected