Narumol Prangnawarat | fe6aa2f | 2021-09-23 16:11:17 +0100 | [diff] [blame^] | 1 | // |
| 2 | // Copyright © 2021 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "OnnxParserTestUtils.hpp" |
| 7 | |
| 8 | #include <fmt/format.h> |
| 9 | |
| 10 | namespace armnnUtils |
| 11 | { |
| 12 | |
| 13 | std::string ConstructTensorShapeString(const std::vector<int>& shape) |
| 14 | { |
| 15 | std::string shapeStr; |
| 16 | for (int i : shape) |
| 17 | { |
| 18 | shapeStr = fmt::format("{} dim {{ dim_value: {} }}", shapeStr, i); |
| 19 | } |
| 20 | return shapeStr; |
| 21 | } |
| 22 | |
| 23 | std::string ConstructIntsAttribute(const std::string& name, |
| 24 | const std::vector<int>& values) |
| 25 | { |
| 26 | std::string attrString = fmt::format("attribute {{ name: '{}'", name);; |
| 27 | for (int i : values) |
| 28 | { |
| 29 | attrString = fmt::format(" {} ints: {}", attrString, i); |
| 30 | } |
| 31 | attrString = fmt::format(" {} type: INTS }}", attrString); |
| 32 | return attrString; |
| 33 | } |
| 34 | |
| 35 | } // namespace armnnUtils |