3 Copyright (c) 2021 Samsung Electronics Co., Ltd.
5 Licensed under the Apache License, Version 2.0 (the License);
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
18 Chen Chen <chen89.chen@samsung.com>
23 <title>MachineLearningSingle_openModel_with_isDynamicMode</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
26 <script src="support/mlsinglecommon.js"></script>
31 //==== TEST: MachineLearningSingle_openModel_with_isDynamicMode
32 //==== LABEL Check if MachineLearningSingle:openModel() method with DynamicMode works properly with optional argument
33 //==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M
36 //==== TEST_CRITERIA MOA MR MAST
38 var model, inputTI1, inputTI2, tensorsData1, tensorsData2, tensorsDataOut1, tensorsDataOut2;
40 model = tizen.ml.single.openModel(
41 TENSORFLOW_LITE_DYNAMICMODE_PATH, null, null, "TENSORFLOW_LITE", "ANY", true);
42 assert_type(model, "object", "the return value should be object type");
44 inputTI1 = new tizen.ml.TensorsInfo();
45 inputTI1.addTensorInfo("tensor1", "FLOAT32", [1, 1, 1, 1]);
46 tensorsData1 = inputTI1.getTensorsData();
48 tensorsDataOut1 = model.invoke(tensorsData1);
50 inputTI2 = new tizen.ml.TensorsInfo();
51 inputTI2.addTensorInfo("tensor2", "FLOAT32", [3, 1, 1, 1]);
52 tensorsData2 = inputTI2.getTensorsData();
55 tensorsDataOut2 = model.invoke(tensorsData2);
57 retValue1 = model.output.getDimensions(0);
58 dismension1 = new Array(3, 1, 1, 1);
59 assert_type(retValue1, "array", "returned value should be long[] type");
60 assert_array_equals(retValue1, dismension1, "returned value should be correct value");
63 //inputTI3 = new tizen.ml.TensorsInfo();
64 //inputTI3.addTensorInfo("tensor3", "FLOAT32", [2, 1, 1, 1]);
66 //model.input = inputTI3;
68 //retValue2 = model.output.getDimensions(0);
69 //dismension2 = new Array(2, 1, 1, 1);
70 //assert_type(retValue2, "array", "returned value should be long[] type");
71 //assert_array_equals(retValue2, dismension2, "returned value should be correct value");
72 tensorsDataOut1.dispose();
73 tensorsDataOut2.dispose();
74 tensorsData1.dispose();
75 tensorsData2.dispose();