mirror of
https://jihulab.com/mr-one/openpilot.git
synced 2026-10-28 05:23:46 +08:00
8d0bf5ee0a
The current recompiled42 model catalog declares tinygrad_ref=fe5d3169b. The old vendored e837 runtime accepted the pkl but left policy outputs at zero, so sync the runtime package to the compiler version used by the downloaded models.
20 lines
661 B
Python
20 lines
661 B
Python
# opt opinionatedly transforms an ast into an optimized ast using either heuristics or beam search
|
|
from __future__ import annotations
|
|
from enum import Enum, auto
|
|
from dataclasses import dataclass
|
|
|
|
class OptOps(Enum):
|
|
TC = auto(); SPLIT = auto(); PADTO = auto(); SWAP = auto() # noqa: E702
|
|
def __lt__(self, x:OptOps): return self.value < x.value
|
|
|
|
@dataclass(frozen=True, order=True)
|
|
class Opt:
|
|
op: OptOps
|
|
axis: int|None = None
|
|
arg: int|tuple|None = None
|
|
def __repr__(self): return f"Opt(op={self.op}, axis={self.axis}, arg={self.arg})"
|
|
|
|
class KernelOptError(Exception): pass
|
|
def check(cond:bool, msg:str=""):
|
|
if not cond: raise KernelOptError(msg)
|