@@ -236,55 +236,97 @@ describe('Test exportModel()/importModel()', () => {
236
236
const inferRequest = compiledModel . createInferRequest ( ) ;
237
237
const res1 = inferRequest . infer ( [ tensor ] ) ;
238
238
239
- it ( 'Test importModel (stream, device)' , ( ) => {
239
+ it ( 'Test importModelSync (stream, device)' , ( ) => {
240
240
const newCompiled = core . importModelSync ( userStream , 'CPU' ) ;
241
241
const newInferRequest = newCompiled . createInferRequest ( ) ;
242
242
const res2 = newInferRequest . infer ( [ tensor ] ) ;
243
243
244
244
assert . deepStrictEqual ( res1 [ 'fc_out' ] . data [ 0 ] , res2 [ 'fc_out' ] . data [ 0 ] ) ;
245
245
} ) ;
246
246
247
- it ( 'Test importModel (stream, device, config)' , ( ) => {
247
+ it ( 'Test importModelSync (stream, device, config)' , ( ) => {
248
248
const newCompiled = core . importModelSync ( userStream , 'CPU' , { 'NUM_STREAMS' : 1 } ) ;
249
249
const newInferRequest = newCompiled . createInferRequest ( ) ;
250
250
const res2 = newInferRequest . infer ( [ tensor ] ) ;
251
251
252
252
assert . deepStrictEqual ( res1 [ 'fc_out' ] . data [ 0 ] , res2 [ 'fc_out' ] . data [ 0 ] ) ;
253
253
} ) ;
254
254
255
- it ( 'Test importModel (stream, device) throws' , ( ) => {
255
+ it ( 'Test importModelSync (stream, device) throws' , ( ) => {
256
256
assert . throws (
257
257
( ) => core . importModelSync ( epsilon , 'CPU' ) ,
258
258
/ T h e f i r s t a r g u m e n t m u s t b e o f t y p e B u f f e r ./
259
259
) ;
260
260
} ) ;
261
261
262
- it ( 'Test importModel (stream, device) throws' , ( ) => {
262
+ it ( 'Test importModelSync (stream, device) throws' , ( ) => {
263
263
assert . throws (
264
264
( ) => core . importModelSync ( userStream , tensor ) ,
265
265
/ T h e s e c o n d a r g u m e n t m u s t b e o f t y p e S t r i n g ./
266
266
) ;
267
267
} ) ;
268
- it ( 'Test importModel (stream, device, config: tensor) throws' , ( ) => {
268
+ it ( 'Test importModelSync (stream, device, config: tensor) throws' , ( ) => {
269
269
assert . throws (
270
270
( ) => core . importModelSync ( userStream , 'CPU' , tensor ) ,
271
271
/ N o t F o u n d : U n s u p p o r t e d p r o p e r t y 0 b y C P U p l u g i n ./
272
272
) ;
273
273
} ) ;
274
274
275
- it ( 'Test importModel (stream, device, config: string) throws' , ( ) => {
275
+ it ( 'Test importModelSync (stream, device, config: string) throws' , ( ) => {
276
276
const testString = 'test' ;
277
277
assert . throws (
278
278
( ) => core . importModelSync ( userStream , 'CPU' , testString ) ,
279
279
/ P a s s e d N a p i : : V a l u e m u s t b e a n o b j e c t ./
280
280
) ;
281
281
} ) ;
282
282
283
- it ( 'Test importModel(stream, device, config: unsupported property) throws' , ( ) => {
283
+ it ( 'Test importModelSync(stream, device, config: unsupported property) \
284
+ throws' , ( ) => {
284
285
const tmpDir = '/tmp' ;
285
286
assert . throws (
286
287
( ) => core . importModelSync ( userStream , 'CPU' , { 'CACHE_DIR' : tmpDir } ) ,
287
288
/ U n s u p p o r t e d p r o p e r t y C A C H E _ D I R b y C P U p l u g i n ./
288
289
) ;
289
290
} ) ;
291
+
292
+ it ( 'Test importModel(stream, device)' , ( ) => {
293
+ core . importModel ( userStream , 'CPU' ) . then ( newCompiled => {
294
+ const newInferRequest = newCompiled . createInferRequest ( ) ;
295
+ const res2 = newInferRequest . infer ( [ tensor ] ) ;
296
+ assert . deepStrictEqual ( res1 [ 'fc_out' ] . data [ 0 ] , res2 [ 'fc_out' ] . data [ 0 ] ) ;
297
+ } ) ;
298
+ } ) ;
299
+
300
+ it ( 'Test importModel(stream, device, config)' , ( ) => {
301
+ core . importModel ( userStream , 'CPU' , { 'NUM_STREAMS' : 1 } ) . then (
302
+ newCompiled => {
303
+ const newInferRequest = newCompiled . createInferRequest ( ) ;
304
+ const res2 = newInferRequest . infer ( [ tensor ] ) ;
305
+
306
+ assert . deepStrictEqual ( res1 [ 'fc_out' ] . data [ 0 ] , res2 [ 'fc_out' ] . data [ 0 ] ) ;
307
+ } ) ;
308
+ } ) ;
309
+
310
+ it ( 'Test importModel(stream, device) throws' , ( ) => {
311
+ assert . throws (
312
+ ( ) => core . importModel ( epsilon , 'CPU' ) . then ( ) ,
313
+ / ' i m p o r t M o d e l ' m e t h o d c a l l e d w i t h i n c o r r e c t p a r a m e t e r s ./
314
+ ) ;
315
+ } ) ;
316
+
317
+ it ( 'Test importModel(stream, device) throws' , ( ) => {
318
+ assert . throws (
319
+ ( ) => core . importModel ( userStream , tensor ) . then ( ) ,
320
+ / ' i m p o r t M o d e l ' m e t h o d c a l l e d w i t h i n c o r r e c t p a r a m e t e r s ./
321
+ ) ;
322
+ } ) ;
323
+
324
+ it ( 'Test importModel(stream, device, config: string) throws' , ( ) => {
325
+ const testString = 'test' ;
326
+ assert . throws (
327
+ ( ) => core . importModel ( userStream , 'CPU' , testString ) . then ( ) ,
328
+ / ' i m p o r t M o d e l ' m e t h o d c a l l e d w i t h i n c o r r e c t p a r a m e t e r s ./
329
+ ) ;
330
+ } ) ;
331
+
290
332
} ) ;
0 commit comments