(spec)
| 299 | |
| 300 | |
| 301 | def parse_bits_map(spec): |
| 302 | m, default = {}, None |
| 303 | for part in str(spec or "").split(","): |
| 304 | if not part.strip(): |
| 305 | continue |
| 306 | k, v = part.split("=", 1) |
| 307 | b = TERNARY_BITS if float(v) == TERNARY_BITS else int(v) |
| 308 | if k.strip() == "default": |
| 309 | default = b |
| 310 | else: |
| 311 | m[canonical_tensor_name(k.strip())] = b |
| 312 | if default is None: |
| 313 | raise ValueError(f"bits map {spec!r} needs a default=<b> entry") |
| 314 | bad = {b for b in list(m.values()) + [default] |
| 315 | if b not in CQ_BITS and b != TERNARY_BITS} |
| 316 | if bad: |
| 317 | raise ValueError(f"bits map {spec!r} has unsupported widths {sorted(bad)}") |
| 318 | return m, default |
| 319 | |
| 320 | |
| 321 | def cq_mixed_params(params, bits_map, default_bits, group_size=CQ_GROUP_SIZE): |
no test coverage detected