aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/SquaredDifference.hpp
blob: c15b379a4d801ca9177753760ab4aabd42e0db22 (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
//
// Copyright © 2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include <cmath>

namespace armnn
{

template<typename T>
struct squaredDifference
{
    typedef T result_type;
    typedef T first_argument_type;

    T
    operator()(const T& input1, const T& input2) const
    {
        float diff = std::minus<>{}(static_cast<float>(input1),static_cast<float>(input2));
        T squaredDiff = armnn::numeric_cast<T>(std::pow(static_cast<float>(diff), 2));
        return squaredDiff;
    }
};

} //namespace armnn