You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/cpu/features/hypertune/resnet50.py
+18-7
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
importtorch
2
2
importtorchvision.modelsasmodels
3
3
4
+
4
5
definference(model, data):
5
6
withtorch.no_grad():
6
7
# warm up
@@ -9,6 +10,7 @@ def inference(model, data):
9
10
10
11
# measure
11
12
importtime
13
+
12
14
measure_iter=100
13
15
start=time.time()
14
16
for_inrange(measure_iter):
@@ -19,8 +21,13 @@ def inference(model, data):
19
21
latency=duration/measure_iter
20
22
throughput=measure_iter/duration
21
23
22
-
print("@hypertune {'name': 'latency (ms)'}") # Add print statement of the form @hypertune {'name': str, 'higher_is_better': bool, 'target_val': int or float}`
23
-
print(latency) # Print the objective(s) you want to optimize. Make sure this is just an int or float to be minimzied or maximized.
24
+
print(
25
+
"@hypertune {'name': 'latency (ms)'}"
26
+
) # Add print statement of the form @hypertune {'name': str, 'higher_is_better': bool, 'target_val': int or float}`
27
+
print(
28
+
latency
29
+
) # Print the objective(s) you want to optimize. Make sure this is just an int or float to be minimzied or maximized.
0 commit comments