diff options
Diffstat (limited to 'runtime/neurun/backend/cpu/ShapeFixer.cc')
-rw-r--r-- | runtime/neurun/backend/cpu/ShapeFixer.cc | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/runtime/neurun/backend/cpu/ShapeFixer.cc b/runtime/neurun/backend/cpu/ShapeFixer.cc deleted file mode 100644 index 835592b30..000000000 --- a/runtime/neurun/backend/cpu/ShapeFixer.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2019 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 "ShapeFixer.h" - -#include <stdexcept> - -#include "cpp14/memory.h" -#include "util/Padding.h" -#include "kernel/OperationUtils.h" -#include "kernel/ConvolutionLayer.h" -#include "kernel/AvgPoolLayer.h" -#include "kernel/MaxPoolLayer.h" -#include "kernel/ConcatLayer.h" -#include "kernel/FullyConnectedLayer.h" -#include "kernel/ReshapeLayer.h" -#include "kernel/SoftMaxLayer.h" -#include "kernel/PermuteLayer.h" -#include "kernel/DepthwiseConvolutionLayer.h" -#include "kernel/AddLayer.h" -#include "kernel/SubLayer.h" -#include "kernel/MulLayer.h" -#include "kernel/GatherLayer.h" - -#include <backend/Backend.h> -#include <backend/IConfig.h> -#include "compiler/IExecutionBuilder.h" - -#include "util/logging.h" - -#include "util/Utils.h" - -namespace neurun -{ -namespace backend -{ -namespace cpu -{ - -ShapeFixer::ShapeFixer(const ir::Operands &operand_ctx, - const std::shared_ptr<TensorBuilder> &tensor_builder) - : _ctx(operand_ctx), _tensor_builder(tensor_builder) -{ - assert(tensor_builder); -} - -void ShapeFixer::visit(const ir::operation::Conv2D &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::DepthwiseConv2D &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::MaxPool2D &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::AvgPool2D &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::Concat &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::FullyConnected &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::Reshape &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::Squeeze &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::Softmax &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::Gather &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::Add &node) -{ - const auto lhs_index{node.getInputs().at(ir::operation::Add::Input::LHS)}; - - // Quantization : not supported - if (_ctx.at(lhs_index).typeInfo().type() == ir::DataType::QUANT8_ASYMM) - { - throw std::runtime_error{"ShapeFixer: NYI for quantized Add"}; - } -} - -void ShapeFixer::visit(const ir::operation::Permute &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::Sub &node) -{ - // The same as Add - const auto lhs_index{node.getInputs().at(ir::operation::Sub::Input::LHS)}; - - // Quantization : not supported - if (_ctx.at(lhs_index).typeInfo().type() == ir::DataType::QUANT8_ASYMM) - { - throw std::runtime_error{"ShapeFixer: NYI for quantized Sub"}; - } -} - -void ShapeFixer::visit(const ir::operation::Mul &node) -{ - // The same as Add - const auto lhs_index{node.getInputs().at(ir::operation::Sub::Input::LHS)}; - - // Quantization : not supported - if (_ctx.at(lhs_index).typeInfo().type() == ir::DataType::QUANT8_ASYMM) - { - throw std::runtime_error{"ShapeFixer: NYI for quantized Mul"}; - } -} - -void ShapeFixer::visit(const ir::operation::Custom &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::Logistic &) { /* DO NOTHING */} - -void ShapeFixer::visit(const ir::operation::Pad &node) -{ - // TODO: empty this method when quantization is supported - const auto lhs_index{node.getInputs().at(ir::operation::Sub::Input::LHS)}; - - // Quantization : not supported - if (_ctx.at(lhs_index).typeInfo().type() == ir::DataType::QUANT8_ASYMM) - { - throw std::runtime_error{"ShapeFixer: NYI for quantized Pad"}; - } -} - -} // namespace cpu -} // namespace backend -} // namespace neurun |