It will be reimplemented taking into account different variations between frameworks.
Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
mir::TensorVariant getResult(const mir::Operation::Output *tensor);
void visit(mir::ops::AddOp &op) override;
- void visit(mir::ops::BatchNormOp &op) override;
void visit(mir::ops::CappedReluOp &op) override;
void visit(mir::ops::ConcatOp &op) override;
void visit(mir::ops::ConstantOp &op) override;
throw AclCppException("Unimplemented operation: SliceOp");
}
-void AclCppOpGenerator::visit(ops::BatchNormOp & /*op*/)
-{
- // Not supported in our framework, but present in ACL API.
- throw AclCppException("Not supported in inference yet.");
-}
-
void AclCppOpGenerator::visit(ops::DropoutOp &op)
{
assert(op.getNumInputs() == 1);
* @param op
*/
void visit(mir::ops::AddOp &op) override;
- void visit(mir::ops::BatchNormOp &op) override;
void visit(mir::ops::CappedReluOp &op) override;
void visit(mir::ops::ConcatOp &op) override;
void visit(mir::ops::ConstantOp &op) override;
#include "passes/interpreter/Interpreter.h"
#include "ops/Add.h"
-#include "ops/BatchNorm.h"
#include "ops/Concat.h"
#include "ops/Conv2D.h"
#include "ops/DeConv2D.h"
setOutputTensors(op, std::move(outputs));
}
-void NNInterpreter::visit(ops::BatchNormOp &op)
-{
- auto inputs = getInputTensors(op);
- auto outputs = BatchNorm<float>(inputs[0], op)();
- setOutputTensors(op, std::move(outputs));
-}
-
void NNInterpreter::visit(ops::SliceOp &op)
{
auto inputs = getInputTensors(op);
+++ /dev/null
-/*
- * Copyright (c) 2018 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.
- */
-
-#ifndef _NNC_CORE_BACKEND_INTERPRETER_BATCHNORM_IMPL_
-#define _NNC_CORE_BACKEND_INTERPRETER_BATCHNORM_IMPL_
-
-#include "OperationImpl.h"
-#include "Fill.h"
-
-#include "mir/ops/BatchNormOp.h"
-
-namespace nnc
-{
-
-/**
- * @brief Implements DropoutOp for interpreter backend
- * @note Simply copies input to output
- * @tparam T type of data in input tensor
- */
-template <typename T> class BatchNorm : public OperationImpl<T>
-{
-public:
- /**
- * @param in input data
- * @param op batch normalization operation description
- */
- explicit BatchNorm(const mir::TensorVariant &input, const mir::ops::BatchNormOp &op)
- : _input(input), _op(op)
- {
- }
-
- /**
- * @brief computes operation aplication result
- * @return vector of all outputs from this node
- */
- std::vector<mir::TensorVariant> operator()() override
- {
- // For now BatchNorm just copies input to output
- return Fill<T>(_input.getShape(), [this](const mir::Index &idx) { return _input.at(idx); })();
- }
-
-private:
- const mir::Tensor<float> _input;
- const mir::ops::BatchNormOp &_op;
-};
-
-} // namespace nnc
-
-#endif // _NNC_CORE_BACKEND_INTERPRETER_BATCHNORM_IMPL_
void ModelAnalyzer::visit(mir::ops::SliceOp &op) { appendOperationToInference(&op, "slice"); }
-void ModelAnalyzer::visit(ops::BatchNormOp &op) { appendOperationToInference(&op, "batchNorm"); }
-
void ModelAnalyzer::visit(mir::ops::TanhOp &op)
{
appendOperationToInference(&op, "tanhActivation");
void analyze(const mir::Graph *g);
void visit(mir::ops::AddOp &op) override;
- void visit(mir::ops::BatchNormOp &op) override;
void visit(mir::ops::CappedReluOp &op) override;
void visit(mir::ops::ConcatOp &op) override;
void visit(mir::ops::ConstantOp &op) override;
serializeShape(op.getOutputShape(0));
}
-void Serializer::visit(ops::BatchNormOp &op)
-{
- _curOp->paramStartOffset = _buffer.size();
- serializeT<float>(op.getEps());
- serializeT<float>(op.getMovingAvgFraction());
- serializeT<int32_t>(op.getSpatial());
-}
-
void Serializer::visit(mir::ops::SliceOp &op)
{
_curOp->paramStartOffset = _buffer.size();
{
public:
void visit(mir::ops::AddOp &op) override;
- void visit(mir::ops::BatchNormOp &op) override;
void visit(mir::ops::CappedReluOp &op) override;
void visit(mir::ops::ConcatOp &op) override;
void visit(mir::ops::ConstantOp &op) override;