2 * Copyright (c) 2019 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 "AttributeHelpers.h"
24 void convertDropoutV1(const onnx::NodeProto &onnx_node, ConverterContext *context)
26 // consumed_inputs attribute not used
27 convertDropoutV6(onnx_node, context);
30 void convertDropoutV6(const onnx::NodeProto &onnx_node, ConverterContext *context)
32 const auto is_test = getAttributeValue<std::int64_t>(onnx_node, "is_test", 0);
34 throw std::runtime_error("Not supported is_test attribute!");
36 convertDropoutV10(onnx_node, context);
39 void convertDropoutV7(const onnx::NodeProto &onnx_node, ConverterContext *context)
41 convertDropoutV10(onnx_node, context);
44 void convertDropoutV10(const onnx::NodeProto &onnx_node, ConverterContext *context)
46 std::vector<mir::Operation::Output *> inputs = context->getNodeInputs(onnx_node);
48 // ratio attribute not used
50 // This is a no-op in inference mode.
51 context->setNodeOutputs(onnx_node, {inputs[0]});
54 } // namespace mir_onnx