aboutsummaryrefslogtreecommitdiff
path: root/src/armnnOnnxParser/test/OnnxParserTestUtils.cpp
blob: 66c40139c9b392597687b9caa4e6d7f5a13ff76b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "OnnxParserTestUtils.hpp"

#include <fmt/format.h>

namespace armnnUtils
{

std::string ConstructTensorShapeString(const std::vector<int>& shape)
{
    std::string shapeStr;
    for (int i : shape)
    {
        shapeStr = fmt::format("{} dim {{ dim_value: {} }}", shapeStr, i);
    }
    return shapeStr;
}

std::string ConstructIntsAttribute(const std::string& name,
                                   const std::vector<int>& values)
{
    std::string attrString = fmt::format("attribute {{ name: '{}'", name);;
    for (int i : values)
    {
        attrString = fmt::format(" {} ints: {}", attrString, i);
    }
    attrString = fmt::format(" {} type: INTS }}", attrString);
    return attrString;
}

} // namespace armnnUtils