mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-25 23:08:06 -05:00
* start diff printing * this should be 2 * add to process_replay.py * enable schedule capture * arange diff is process replay
12 lines
453 B
Python
12 lines
453 B
Python
import difflib, logging
|
|
from tinygrad.helpers import colored, getenv
|
|
|
|
def print_diff(s0, s1, unified=getenv("UNIFIED_DIFF",1)):
|
|
if unified:
|
|
lines = list(difflib.unified_diff(str(s0).splitlines(), str(s1).splitlines()))
|
|
diff = "\n".join(colored(line, "red" if line.startswith("-") else "green" if line.startswith("+") else None) for line in lines)
|
|
else:
|
|
import ocdiff
|
|
diff = ocdiff.console_diff(str(s0), str(s1))
|
|
logging.info(diff)
|