This operation is not a part of the ONNX specification. It is probably a copy&paste from the Caffe2 importer.
Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
Op/Relu.h
Op/Reshape.cpp
Op/Reshape.h
- Op/Scale.cpp
- Op/Scale.h
Op/Shape.cpp
Op/Shape.h
Op/Sigmoid.cpp
return result->f();
}
-// Create vector tensor filled with the given value
-// TODO Remove.
-inline mir::TensorVariant createScalarTensor(float value, const mir::Shape &shape)
-{
- std::vector<float> values(static_cast<std::size_t>(shape.numElements()), value);
- return mir::TensorVariant(mir::DTYPE::FLOAT32, {shape.numElements()}, values.data());
-}
-
struct KernelStridesPadding
{
mir::Shape kernel_shape;
#include "Op/Pad.h"
#include "Op/Relu.h"
#include "Op/Reshape.h"
-#include "Op/Scale.h"
#include "Op/Shape.h"
#include "Op/Sigmoid.h"
#include "Op/Softmax.h"
registry.registerConverter("Pad", stdex::make_unique<PadNodeConverter>());
registry.registerConverter("Relu", stdex::make_unique<ReluNodeConverter>());
registry.registerConverter("Reshape", stdex::make_unique<ReshapeNodeConverter>());
- registry.registerConverter("Scale", stdex::make_unique<ScaleNodeConverter>());
registry.registerConverter("Shape", stdex::make_unique<ShapeNodeConverter>());
registry.registerConverter("Sigmoid", stdex::make_unique<SigmoidNodeConverter>());
registry.registerConverter("Softmax", stdex::make_unique<SoftmaxNodeConverter>());
+++ /dev/null
-/*
- * 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 "Scale.h"
-
-#include "ONNXHelpers.h"
-
-#include "mir/ops/MulOp.h"
-#include "mir/ops/ConstantOp.h"
-
-namespace mir_onnx
-{
-
-std::vector<mir::Operation::Output *>
-ScaleNodeConverter::convert(const onnx::NodeProto &onnx_node,
- const std::vector<mir::Operation::Output *> &inputs,
- mir::Graph *graph) const
-{
- // 1.0f is the default scale factor
- float scale_val = getFloatAttribute(onnx_node, "scale", 1.0f);
- const auto &shape = inputs[0]->getShape();
- auto scale_tensor = createScalarTensor(scale_val, shape);
- auto scale = createOp<mir::ops::ConstantOp>(graph, scale_tensor)->getOutput(0);
- auto result = createOp<mir::ops::MulOp>(graph, inputs[0], scale)->getOutput(0);
- return {result};
-}
-
-} // namespace mir_onnx
+++ /dev/null
-/*
- * 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 "ONNXNodeConverterRegistry.h"
-
-namespace mir_onnx
-{
-
-class ScaleNodeConverter : public NodeConverter
-{
-public:
- std::vector<mir::Operation::Output *> convert(const onnx::NodeProto &onnx_node,
- const std::vector<mir::Operation::Output *> &inputs,
- mir::Graph *graph) const override;
-};
-
-} // namespace mir_onnx