2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <cker/operation/Pow.h>
20 #include <cker/operation/BinaryArithmeticOps.h>
31 void PowLayer::powFloat32()
33 float output_activation_min = 0, output_activation_max = 0;
34 CalculateActivationRange(_activation, &output_activation_min, &output_activation_max);
35 nnfw::cker::BinaryArithmeticOpParam op_params;
36 op_params.float_activation_max = output_activation_max;
37 op_params.float_activation_min = output_activation_min;
39 if (!HaveSameShapes(_lhs, _rhs))
41 nnfw::cker::BroadcastBinaryArithmeticOp<nnfw::cker::BinaryArithmeticOpType::POW>(
42 op_params, getShape(_lhs), getBuffer<float>(_lhs), getShape(_rhs), getBuffer<float>(_rhs),
43 getShape(_output), getBuffer<float>(_output));
47 nnfw::cker::powImpl(getShape(_lhs), getBuffer<float>(_lhs), getShape(_rhs),
48 getBuffer<float>(_rhs), getShape(_output), getBuffer<float>(_output));
51 void PowLayer::configure(const IPortableTensor *lhs, const IPortableTensor *rhs,
52 ir::Activation activation, IPortableTensor *output)
56 _activation = activation;
62 if (_output->data_type() == OperandType::FLOAT32)
65 throw std::runtime_error{"Pow: unsupportted data type"};
70 } // namespace backend