2 * Copyright (c) 2020 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.
17 #ifndef __LUCI_IR_CIRCLETRANSPOSECONV_H__
18 #define __LUCI_IR_CIRCLETRANSPOSECONV_H__
20 #include "luci/IR/CircleNodeDecl.h"
21 #include "luci/IR/CircleOpcode.h"
23 #include "luci/IR/AttrPadding.h"
24 #include "luci/IR/AttrStride.h"
25 #include "luci/IR/CircleNodeMixins.h"
31 * @brief TRANSPOSE_CONV in Circle
33 * @note Argument node function names are from TensorFlow. So referring 'in' and
34 * 'out' acutally means 'out' and 'in' of the this node.
36 class CircleTransposeConv final
37 : public FixedArityNode<4, CircleNodeImpl<CircleOpcode::TRANSPOSE_CONV>>,
38 public CircleNodeMixin<CircleNodeTrait::Bias>
41 loco::Node *inputSizes(void) const { return at(0)->node(); }
42 void inputSizes(Node *node) { at(0)->node(node); }
44 loco::Node *filter(void) const { return at(1)->node(); }
45 void filter(Node *node) { at(1)->node(node); }
47 loco::Node *outBackprop(void) const { return at(2)->node(); }
48 void outBackprop(Node *node) { at(2)->node(node); }
51 * @note "bias" is optional. When this node has no conceptual bias, "bias()"
52 * expected to be `luci::CircleOutputExclude` type.
54 * <Comment on tflite TRANSPOSE_CONV>
56 * (Circle node has no dependency on tflite, but just for information on converting)
57 * Before TF v2.3.0, tflite TRANSPOSE_CONV didn't support fused bias as argument.
58 * From TF v2.3.0, tflite TRANSPOSE_CONV supports bias as optional 4th argument.
60 * Ref: https://github.com/tensorflow/tensorflow/commit/43b8f6e710
62 loco::Node *bias(void) const override { return at(3)->node(); }
63 void bias(loco::Node *node) override { at(3)->node(node); }
66 const Padding &padding(void) const { return _padding; }
67 void padding(const Padding &padding) { _padding = padding; }
69 const Stride *stride(void) const { return &_stride; }
70 Stride *stride(void) { return &_stride; }
73 Padding _padding{Padding::UNDEFINED};
79 #endif // __LUCI_IR_CIRCLETRANSPOSECONV_H__