allow benchmarking forward only (#5436)

This commit is contained in:
wozeparrot
2024-07-13 00:37:49 +00:00
committed by GitHub
parent 00813a92a0
commit b80fd7d23c

View File

@@ -8,19 +8,21 @@ if __name__ == "__main__":
img = Tensor.empty(64, 3, 224, 224)
PROFILE = getenv("PROFILE", 1)
FORWARD_ONLY = getenv("FORWARD_ONLY", 0)
with Profiling(PROFILE):
with Timing("***** model forward in "):
out = mdl(img)
with Profiling(PROFILE):
with Timing("***** model schedule in "):
sched = out.schedule()
if not FORWARD_ONLY:
with Profiling(PROFILE):
with Timing("***** model schedule in "):
sched = out.schedule()
# snakeviz /tmp/schedule.prof
with Profiling(PROFILE, fn="/tmp/schedule.prof"):
with Timing("***** model lower in "):
eis = list(lower_schedule(sched))
# snakeviz /tmp/schedule.prof
with Profiling(PROFILE, fn="/tmp/schedule.prof"):
with Timing("***** model lower in "):
eis = list(lower_schedule(sched))
# random makes this slow
#with Profiling(PROFILE):