@@ -173,8 +173,9 @@ def forward(self, input):
173
173
174
174
input = torch .randn (2 , 4 )
175
175
model = Model ()
176
+ model .eval ()
176
177
# Invoke optimize function against the model object
177
- model = ipex .optimize (model )
178
+ model = ipex .optimize (model , dtype = torch . float32 )
178
179
res = model (input )
179
180
180
181
###############################################################################
@@ -196,6 +197,7 @@ def forward(self, input):
196
197
197
198
input = torch .randn (2 , 4 )
198
199
model = Model ()
200
+ model .eval ()
199
201
# Invoke optimize function against the model object with data type set to torch.bfloat16
200
202
model = ipex .optimize (model , dtype = torch .bfloat16 )
201
203
with torch .cpu .amp .autocast ():
@@ -233,9 +235,10 @@ def forward(self, input):
233
235
234
236
input = torch .randn (2 , 4 )
235
237
model = Model ()
238
+ model .eval ()
236
239
# Invoke optimize function against the model object
237
- model = ipex .optimize (model )
238
- model = torch .jit .trace (model , torch .rand ( args . batch_size , 3 , 224 , 224 ))
240
+ model = ipex .optimize (model , dtype = torch . float32 )
241
+ model = torch .jit .trace (model , torch .randn ( 2 , 4 ))
239
242
model = torch .jit .freeze (model )
240
243
res = model (input )
241
244
@@ -261,10 +264,11 @@ def forward(self, input):
261
264
262
265
input = torch .randn (2 , 4 )
263
266
model = Model ()
267
+ model .eval ()
264
268
# Invoke optimize function against the model with data type set to torch.bfloat16
265
269
model = ipex .optimize (model , dtype = torch .bfloat16 )
266
270
with torch .cpu .amp .autocast ():
267
- model = torch .jit .trace (model , torch .rand ( args . batch_size , 3 , 224 , 224 ))
271
+ model = torch .jit .trace (model , torch .randn ( 2 , 4 ))
268
272
model = torch .jit .freeze (model )
269
273
res = model (input )
270
274
@@ -327,6 +331,12 @@ def forward(self, input):
327
331
set_property(TARGET example-app PROPERTY CXX_STANDARD 14)
328
332
'''
329
333
334
+ ###############################################################################
335
+ # **Note:** Since Intel® Extension for PyTorch* is still under development, name of
336
+ # the c++ dynamic library in the master branch may defer to
337
+ # *libintel-ext-pt-cpu.so* shown above. Please check the name out in the
338
+ # installation folder. The so file name starts with *libintel-*.
339
+
330
340
###############################################################################
331
341
# **Command for compilation**
332
342
0 commit comments