aboutsummaryrefslogtreecommitdiff
path: root/src/armnnUtils/PrototxtConversions.cpp
blob: 1a6c053355633d412aec7328db5eacc2198467a1 (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
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "PrototxtConversions.hpp"

#include <boost/format.hpp>

#include <iomanip>
#include <sstream>
#include <string>

namespace armnnUtils
{

/// Converts an int value into the Prototxt octal representation
std::string ConvertInt32ToOctalString(int value)
{
    std::stringstream ss;
    std::string returnString;
    for (int i = 0; i < 4; ++i)
    {
        ss << "\\";
        ss << std::setw(3) << std::setfill('0') << std::oct << ((value >> (i * 8)) & 0xFF);
    }

    ss >> returnString;
    return returnString;
}

} // namespace armnnUtils