• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.nn.benchmark.app;
18 
19 import androidx.test.filters.LargeTest;
20 import androidx.test.filters.MediumTest;
21 
22 import com.android.nn.benchmark.core.TestModels.TestModelEntry;
23 
24 import org.junit.Test;
25 import org.junit.runner.RunWith;
26 import org.junit.runners.Parameterized;
27 
28 @RunWith(Parameterized.class)
29 public class TFLiteTest extends BenchmarkTestBase {
30 
TFLiteTest(TestModelEntry model)31     public TFLiteTest(TestModelEntry model) {
32         super(model, /*acceleratorName=*/null);
33     }
34 
35     @Override
prepareTest()36     protected void prepareTest() {
37         super.prepareTest();
38         setUseNNApi(false);
39     }
40 
41     @Test
42     @LargeTest
testTFLite10Seconds()43     public void testTFLite10Seconds() {
44         TestAction ta = new TestAction(mModel, WARMUP_REPEATABLE_SECONDS,
45                 RUNTIME_REPEATABLE_SECONDS);
46         runTest(ta, mModel.getTestName());
47     }
48 
49     @Test
50     @MediumTest
testTFLite()51     public void testTFLite() {
52         TestAction ta = new TestAction(mModel, WARMUP_SHORT_SECONDS,
53                 RUNTIME_SHORT_SECONDS);
54         runTest(ta, mModel.getTestName());
55     }
56 
57     @Test
58     @LargeTest
testTFLiteAllData()59     public void testTFLiteAllData() {
60         setCompleteInputSet(true);
61         TestAction ta = new TestAction(mModel, WARMUP_REPEATABLE_SECONDS,
62                 COMPLETE_SET_TIMEOUT_SECOND);
63         runTest(ta, mModel.getTestName());
64     }
65 }
66