@@ -14,10 +14,10 @@ const compiledModel = core.compileModelSync(model, 'CPU');
14
14
const modelLike = [ [ model ] ,
15
15
[ compiledModel ] ] ;
16
16
17
- it ( 'Core.getAvailableDevices()' , ( ) => {
18
- const devices = core . getAvailableDevices ( ) ;
19
-
20
- assert . ok ( devices . includes ( 'CPU' ) ) ;
17
+ it ( 'Core.getAvailableDevices()' , ( ) => {
18
+ const devices = core . getAvailableDevices ( ) ;
19
+
20
+ assert . ok ( devices . includes ( 'CPU' ) ) ;
21
21
} ) ;
22
22
23
23
describe ( 'Core.getVersions()' , ( ) => {
@@ -214,16 +214,62 @@ describe('Input class for ov::Input<const ov::Node>', () => {
214
214
215
215
} ) ;
216
216
217
- it ( 'Test exportModel()/importModel()' , ( ) => {
217
+ describe ( 'Test exportModel()/importModel()' , ( ) => {
218
218
const userStream = compiledModel . exportModelSync ( ) ;
219
- const newCompiled = core . importModelSync ( userStream , 'CPU' ) ;
220
219
const epsilon = 0.5 ;
221
220
const tensor = Float32Array . from ( { length : 3072 } , ( ) => ( Math . random ( ) + epsilon ) ) ;
222
-
223
221
const inferRequest = compiledModel . createInferRequest ( ) ;
224
222
const res1 = inferRequest . infer ( [ tensor ] ) ;
225
- const newInferRequest = newCompiled . createInferRequest ( ) ;
226
- const res2 = newInferRequest . infer ( [ tensor ] ) ;
227
223
228
- assert . deepStrictEqual ( res1 [ 'fc_out' ] . data [ 0 ] , res2 [ 'fc_out' ] . data [ 0 ] ) ;
224
+ it ( 'Test importModel(stream, device)' , ( ) => {
225
+ const newCompiled = core . importModelSync ( userStream , 'CPU' ) ;
226
+ const newInferRequest = newCompiled . createInferRequest ( ) ;
227
+ const res2 = newInferRequest . infer ( [ tensor ] ) ;
228
+
229
+ assert . deepStrictEqual ( res1 [ 'fc_out' ] . data [ 0 ] , res2 [ 'fc_out' ] . data [ 0 ] ) ;
230
+ } ) ;
231
+
232
+ it ( 'Test importModel(stream, device, config)' , ( ) => {
233
+ const newCompiled = core . importModelSync ( userStream , 'CPU' , { 'NUM_STREAMS' : 1 } ) ;
234
+ const newInferRequest = newCompiled . createInferRequest ( ) ;
235
+ const res2 = newInferRequest . infer ( [ tensor ] ) ;
236
+
237
+ assert . deepStrictEqual ( res1 [ 'fc_out' ] . data [ 0 ] , res2 [ 'fc_out' ] . data [ 0 ] ) ;
238
+ } ) ;
239
+
240
+ it ( 'Test importModel(stream, device) throws' , ( ) => {
241
+ assert . throws (
242
+ ( ) => core . importModelSync ( epsilon , 'CPU' ) ,
243
+ / 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 ./
244
+ ) ;
245
+ } ) ;
246
+
247
+ it ( 'Test importModel(stream, device) throws' , ( ) => {
248
+ assert . throws (
249
+ ( ) => core . importModelSync ( userStream , tensor ) ,
250
+ / 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 ./
251
+ ) ;
252
+ } ) ;
253
+ it ( 'Test importModel(stream, device, config: tensor) throws' , ( ) => {
254
+ assert . throws (
255
+ ( ) => core . importModelSync ( userStream , 'CPU' , tensor ) ,
256
+ / 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 ./
257
+ ) ;
258
+ } ) ;
259
+
260
+ it ( 'Test importModel(stream, device, config: string) throws' , ( ) => {
261
+ const testString = 'test' ;
262
+ assert . throws (
263
+ ( ) => core . importModelSync ( userStream , 'CPU' , testString ) ,
264
+ / 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 ./
265
+ ) ;
266
+ } ) ;
267
+
268
+ it ( 'Test importModel(stream, device, config: unsupported property) throws' , ( ) => {
269
+ const tmpDir = '/tmp' ;
270
+ assert . throws (
271
+ ( ) => core . importModelSync ( userStream , 'CPU' , { 'CACHE_DIR' : tmpDir } ) ,
272
+ / 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 ./
273
+ ) ;
274
+ } ) ;
229
275
} ) ;
0 commit comments