8000 fix the format of compile inference example · pytorch/pytorch@f84b236 · GitHub
[go: up one dir, main page]

Skip to content

Commit f84b236

Browse files
committed
fix the format of compile inference example
1 parent e777d0c commit f84b236

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

docs/source/notes/get_start_xpu.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -163,22 +163,22 @@ Inference with ``torch.compile``
163163
model = model.to("xpu")
164164
data = data.to("xpu")
165165
166-
for i in range(ITERS):
167-
start = time.time()
168-
with torch.no_grad():
169-
model(data)
170-
torch.xpu.synchronize()
171-
end = time.time()
172-
print(f"Inference time before torch.compile for iteration {i}: {(end-start)*1000} ms")
173-
174-
model = torch.compile(model)
175-
for i in range(ITERS):
176-
start = time.time()
177-
with torch.no_grad():
178-
model(data)
179-
torch.xpu.synchronize()
180-
end = time.time()
181-
print(f"Inference time after torch.compile for iteration {i}: {(end-start)*1000} ms")
166+
for i in range(ITERS):
8000 167+
start = time.time()
168+
with torch.no_grad():
169+
model(data)
170+
torch.xpu.synchronize()
171+
end = time.time()
172+
print(f"Inference time before torch.compile for iteration {i}: {(end-start)*1000} ms")
173+
174+
model = torch.compile(model)
175+
for i in range(ITERS):
176+
start = time.time()
177+
with torch.no_grad():
178+
model(data)
179+
torch.xpu.synchronize()
180+
end = time.time()
181+
print(f"Inference time after torch.compile for iteration {i}: {(end-start)*1000} ms")
182182
183183
print("Execution finished")
184184

0 commit comments

Comments
 (0)
0