mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
use UOp.render in colored_shape (#7321)
similar to function name, print rendered str instead of raw UOp
This commit is contained in:
@@ -190,7 +190,8 @@ class Kernel:
|
||||
return colors
|
||||
|
||||
def colored_shape(self, pad:Optional[int]=None, dense=False) -> str:
|
||||
ret = ' '.join(colored(s, color) for s,color in zip([f"{s:4d}" if isinstance(s, int) and not dense else s for s in self.full_shape], self.colors())) # noqa: E501
|
||||
shape_strs = [(s if dense else f"{s:4d}") if isinstance(s, int) else s.render() for s in self.full_shape]
|
||||
ret = ' '.join(colored(s, color) for s,color in zip(shape_strs, self.colors()))
|
||||
if pad: ret += ' '*(pad-ansilen(ret))
|
||||
return ret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user