aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/StaticRangeVisitor.cpp
blob: 8e90ba8b51516e6b0cb88e3e0fceec0c1aa0f8ef (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
36
37
38
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "StaticRangeVisitor.hpp"


namespace armnn
{

void StaticRangeVisitor::SetRange(const IConnectableLayer* layer, unsigned int outputIdx, float min, float max)
{
    auto& ranges = m_GuidToRangesMap[layer->GetGuid()];

    if (ranges.size() < layer->GetNumOutputSlots())
    {
        ranges.resize(layer->GetNumOutputSlots());
    }
    ranges[outputIdx] = std::make_pair(min, max);
}

StaticRangeVisitor::MinMaxRange StaticRangeVisitor::GetRange(LayerGuid guid, unsigned int idx) const
{
    auto found = m_GuidToRangesMap.find(guid);
    if (found != m_GuidToRangesMap.end())
    {
        return found->second.at(idx);
    }
    return DefaultRange();
}

void StaticRangeVisitor::VisitAdditionLayer(const IConnectableLayer *layer, const char *name)
{
    SetRange(layer, 0, -20.f, 20.f);
};

} //namespace armnn