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 android.test.suitebuilder.annotation.LargeTest; 20 import android.test.suitebuilder.annotation.MediumTest; 21 22 import com.android.nn.benchmark.core.TestModels.TestModelEntry; 23 import org.junit.Test; 24 import org.junit.runners.Parameterized; 25 import org.junit.runner.RunWith; 26 27 @RunWith(Parameterized.class) 28 public class TFLiteTest extends BenchmarkTestBase { 29 TFLiteTest(TestModelEntry model)30 public TFLiteTest(TestModelEntry model) { 31 super(model, /*acceleratorName=*/null); 32 } 33 34 @Override prepareTest()35 protected void prepareTest() { 36 super.prepareTest(); 37 setUseNNApi(false); 38 } 39 40 @Test 41 @LargeTest testTFLite10Seconds()42 public void testTFLite10Seconds() { 43 TestAction ta = new TestAction(mModel, WARMUP_REPEATABLE_SECONDS, 44 RUNTIME_REPEATABLE_SECONDS); 45 runTest(ta, mModel.getTestName()); 46 } 47 48 @Test 49 @MediumTest testTFLite()50 public void testTFLite() { 51 TestAction ta = new TestAction(mModel, WARMUP_SHORT_SECONDS, 52 RUNTIME_SHORT_SECONDS); 53 runTest(ta, mModel.getTestName()); 54 } 55 56 @Test 57 @LargeTest testTFLiteAllData()58 public void testTFLiteAllData() { 59 setCompleteInputSet(true); 60 TestAction ta = new TestAction(mModel, WARMUP_REPEATABLE_SECONDS, 61 COMPLETE_SET_TIMEOUT_SECOND); 62 runTest(ta, mModel.getTestName()); 63 } 64 } 65