From 677d43fa8f55a8aa52e6bd9d1884e2797650fd65 Mon Sep 17 00:00:00 2001 From: Liam Barry Date: Thu, 3 Aug 2023 18:21:58 +0100 Subject: MLECO-4260: Replace raw C++ pointers with smart variants Model: Added std::unique_ptr qualifier to Model.cc member and used make_unique when creating interpreter object Removed custom destructor and un-necessary memory cleanup following failed allocation DataStructures: Refactored array 2d to use a std::vector under the hood. This should preserve desired attributes including contiguous memory while removing the need for custom destructor. Original size function renamed to dimSize to avoid confusion with vector.size() Accompanying changes made to preprocessing and ASR tests. AppContext: Replaced use of raw pointers in AppContext.hpp. Previously a std::map including IAttribute pointers required individual deallocation as they were allocated using new. Signed-off-by: Liam Barry Change-Id: I1a34dce5dea6ecf4883a9ada3a20f827eb6e6d6b --- tests/use_case/asr/AsrFeaturesTests.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/use_case/asr/AsrFeaturesTests.cc b/tests/use_case/asr/AsrFeaturesTests.cc index e88d932..0518ade 100644 --- a/tests/use_case/asr/AsrFeaturesTests.cc +++ b/tests/use_case/asr/AsrFeaturesTests.cc @@ -1,6 +1,6 @@ /* - * SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates - * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates + * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,14 +100,14 @@ TEST_CASE("Floating point asr features calculation", "[ASR]") /* First 4 and last 4 values are different because we pad AFTER diff calculated. */ for (size_t i = 0; i < numMfccFeats; ++i) { const float* start_goldenDelta1Buf = goldenDelta1Buf[i].data() + 4; - const float* start_delta1 = delta1Buf.begin() + i * delta1Buf.size(1) + 4; + const float* start_delta1 = delta1Buf.begin() + i * delta1Buf.dimSize(1) + 4; std::vector goldenDataDelta1(start_goldenDelta1Buf, start_goldenDelta1Buf + numFeatVectors - 8); std::vector tensorDataDelta1(start_delta1, start_delta1 + numFeatVectors - 8); CheckOutputs(goldenDataDelta1,tensorDataDelta1); const float* start_goldenDelta2Buf = goldenDelta2Buf[i].data() + 4; - const float* start_delta2 = delta2Buf.begin() + i * delta2Buf.size(1) + 4; + const float* start_delta2 = delta2Buf.begin() + i * delta2Buf.dimSize(1) + 4; std::vector goldenDataDelta2(start_goldenDelta2Buf, start_goldenDelta2Buf + numFeatVectors - 8); std::vector tensorDataDelta2(start_delta2, start_delta2 + numFeatVectors - 8); -- cgit v1.2.1