File tree Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -163,22 +163,22 @@ Inference with ``torch.compile``
163
163
model = model.to("xpu")
164
164
data = data.to("xpu")
165
165
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")
182
182
183
183
print("Execution finished")
184
184
You can’t perform that action at this time.
0 commit comments