blob: 770944d02e7e1d5cde51c9690ef9d137acf8b1a4 [file] [log] [blame]
alexander3c798932021-03-26 21:42:19 +00001/*
2 * Copyright (c) 2021 Arm Limited. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 *
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
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17#include "DsCnnModel.hpp"
18#include "Wav2LetterModel.hpp"
19
20#include <catch.hpp>
21
22/* Skip this test, Wav2LetterModel if not Vela optimized but only from ML-zoo will fail. */
23TEST_CASE("Init two Models", "[.]")
24{
25 arm::app::DsCnnModel model1;
26 arm::app::DsCnnModel model2;
27
28 /* Ideally we should load the wav2letter model here, but there is
29 * none available to run on native (ops not supported on unoptimised
30 * version). However, we can certainly create two instances of the
31 * same type of model to see if our tensor arena re-use works as
32 * intended.
33 *
34 * @TODO: uncomment this when this model can run on native pipeline. */
35 //arm::app::Wav2LetterModel model2; /* model2. */
36
37 /* Load/initialise the first model. */
38 REQUIRE(model1.Init());
39
40 /* Allocator instance should have been created. */
41 REQUIRE(nullptr != model1.GetAllocator());
42
43 /* Load the second model using the same allocator as model 1. */
44 REQUIRE(model2.Init(model1.GetAllocator()));
45
46 /* Make sure they point to the same allocator object. */
47 REQUIRE(model1.GetAllocator() == model2.GetAllocator());
48
49 /* Both models should report being initialised. */
50 REQUIRE(true == model1.IsInited());
51 REQUIRE(true == model2.IsInited());
52}