diff options
Diffstat (limited to 'runtime/onert/backend/cpu/ops/MaxLayer.cc')
-rw-r--r-- | runtime/onert/backend/cpu/ops/MaxLayer.cc | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/runtime/onert/backend/cpu/ops/MaxLayer.cc b/runtime/onert/backend/cpu/ops/MaxLayer.cc deleted file mode 100644 index 9631983be..000000000 --- a/runtime/onert/backend/cpu/ops/MaxLayer.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "MaxLayer.h" - -#include "OperationUtils.h" - -#include <cker/operation/MaxMin.h> - -namespace onert -{ -namespace backend -{ -namespace cpu -{ -namespace ops -{ - -template <typename T> void MaxLayer::maximum() -{ - nnfw::cker::Max<T>(getTensorShape(_lhs), reinterpret_cast<const T *>(_lhs->buffer()), - getTensorShape(_rhs), reinterpret_cast<const T *>(_rhs->buffer()), - getTensorShape(_output), reinterpret_cast<T *>(_output->buffer())); -} - -void MaxLayer::maxQuant8() -{ - if (_lhs->data_scale() == _rhs->data_scale() && _lhs->data_scale() == _output->data_scale()) - { - if (_lhs->data_offset() == _rhs->data_offset() && _lhs->data_offset() == _output->data_offset()) - { - return nnfw::cker::Max<uint8_t>( - getTensorShape(_lhs), reinterpret_cast<const uint8_t *>(_lhs->buffer()), - getTensorShape(_rhs), reinterpret_cast<const uint8_t *>(_rhs->buffer()), - getTensorShape(_output), reinterpret_cast<uint8_t *>(_output->buffer())); - } - } - throw std::runtime_error("Max NYI for quantized"); -} - -void MaxLayer::configure(const IPortableTensor *lhs, const IPortableTensor *rhs, - IPortableTensor *output) -{ - assert(lhs != nullptr); - assert(rhs != nullptr); - assert(output != nullptr); - - _lhs = lhs; - _rhs = rhs; - _output = output; -} - -void MaxLayer::run() -{ - if (_lhs->data_type() == OperandType::FLOAT32) - { - maximum<float>(); - } - else if (_lhs->data_type() == OperandType::QUANT_UINT8_ASYMM) - { - maxQuant8(); - } - else - { - throw std::runtime_error{"Max: unsupported data type"}; - } -} - -} // namespace ops -} // namespace cpu -} // namespace backend -} // namespace onert |