fix vectorized dtype repr [run_process_replay] (#6535)

This commit is contained in:
qazal
2024-09-16 13:42:55 +08:00
committed by GitHub
parent 9b9b83b8b0
commit 607113fcdf
2 changed files with 5 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ class DType:
name: str
fmt: Optional[str]
count: int
def __repr__(self): return f"dtypes.{'_'*(c:=self.count!=1)}{INVERSE_DTYPES_DICT[self.name if not c else self.scalar().name]}{str(self.count)*c}"
def __repr__(self): return f"dtypes.{INVERSE_DTYPES_DICT[self.scalar().name]}"+(f".vec({self.count})" if self.count > 1 else "")
def vec(self, sz:int):
assert self.count == 1, f"can't vectorize {self} with size {sz}"
if sz == 1 or self.name == 'void': return self # void doesn't vectorize, and sz=1 is scalar