From f4cf19e579a19c5346ccb2aad55bfd251065e447 Mon Sep 17 00:00:00 2001 From: Chunseok Lee Date: Mon, 23 Aug 2021 13:25:15 +0900 Subject: Imported Upstream version 1.17.0 --- .../luci/lang/include/luci/IR/CircleNodeMixins.h | 6 +- compiler/luci/lang/include/luci/IR/CircleNodes.h | 1 + compiler/luci/lang/include/luci/IR/CircleNodes.lst | 261 +++++++++++---------- compiler/luci/lang/include/luci/IR/Module.h | 20 ++ .../luci/lang/include/luci/IR/Nodes/CircleConst.h | 2 + .../luci/lang/include/luci/IR/Nodes/CircleCustom.h | 5 +- .../lang/include/luci/IR/Nodes/CircleQuantize.h | 40 ++++ 7 files changed, 199 insertions(+), 136 deletions(-) create mode 100644 compiler/luci/lang/include/luci/IR/Nodes/CircleQuantize.h (limited to 'compiler/luci/lang/include') diff --git a/compiler/luci/lang/include/luci/IR/CircleNodeMixins.h b/compiler/luci/lang/include/luci/IR/CircleNodeMixins.h index 3f8ab7d61..158d65d90 100644 --- a/compiler/luci/lang/include/luci/IR/CircleNodeMixins.h +++ b/compiler/luci/lang/include/luci/IR/CircleNodeMixins.h @@ -67,7 +67,7 @@ public: * * TODO Deprecated this class, and use loco::FixedArity instead */ -template class FixedArityNode : public Base +template class FixedArityNode : public Base { public: FixedArityNode() @@ -82,7 +82,7 @@ public: virtual ~FixedArityNode() = default; public: - unsigned arity(void) const final { return N; } + uint32_t arity(void) const final { return N; } loco::Node *arg(uint32_t n) const final { return _args.at(n)->node(); } @@ -96,7 +96,7 @@ public: protected: // This API allows inherited classes to access "_args" field. - loco::Use *at(unsigned n) const { return _args.at(n).get(); } + loco::Use *at(uint32_t n) const { return _args.at(n).get(); } private: std::vector> _args{}; diff --git a/compiler/luci/lang/include/luci/IR/CircleNodes.h b/compiler/luci/lang/include/luci/IR/CircleNodes.h index 69a82a7b9..a313f9d5b 100644 --- a/compiler/luci/lang/include/luci/IR/CircleNodes.h +++ b/compiler/luci/lang/include/luci/IR/CircleNodes.h @@ -81,6 +81,7 @@ #include "Nodes/CirclePad.h" #include "Nodes/CirclePadV2.h" #include "Nodes/CirclePow.h" +#include "Nodes/CircleQuantize.h" #include "Nodes/CirclePRelu.h" #include "Nodes/CircleRange.h" #include "Nodes/CircleRank.h" diff --git a/compiler/luci/lang/include/luci/IR/CircleNodes.lst b/compiler/luci/lang/include/luci/IR/CircleNodes.lst index b93fdc89d..914aa16e4 100644 --- a/compiler/luci/lang/include/luci/IR/CircleNodes.lst +++ b/compiler/luci/lang/include/luci/IR/CircleNodes.lst @@ -15,135 +15,136 @@ // .Input("value: T") <-- Input name is 'value' // -CIRCLE_NODE(ABS, luci::CircleAbs) -CIRCLE_NODE(ADD, luci::CircleAdd) -CIRCLE_NODE(ADD_N, luci::CircleAddN) -CIRCLE_NODE(ARG_MAX, luci::CircleArgMax) -CIRCLE_NODE(ARG_MIN, luci::CircleArgMin) -CIRCLE_NODE(AVERAGE_POOL_2D, luci::CircleAveragePool2D) -CIRCLE_NODE(BATCH_TO_SPACE_ND, luci::CircleBatchToSpaceND) -CIRCLE_NODE(BATCH_MATMUL, luci::CircleBatchMatMul) -CIRCLE_NODE(BIDIRECTIONAL_SEQUENCE_LSTM, luci::CircleBidirectionalSequenceLSTM) -CIRCLE_NODE(CAST, luci::CircleCast) -CIRCLE_NODE(CEIL, luci::CircleCeil) -CIRCLE_NODE(CONCATENATION, luci::CircleConcatenation) -CIRCLE_NODE(CONV_2D, luci::CircleConv2D) -CIRCLE_NODE(COS, luci::CircleCos) -CIRCLE_NODE(CUSTOM, luci::CircleCustom) -CIRCLE_NODE(DEPTH_TO_SPACE, luci::CircleDepthToSpace) -CIRCLE_NODE(DEPTHWISE_CONV_2D, luci::CircleDepthwiseConv2D) -CIRCLE_NODE(DEQUANTIZE, luci::CircleDequantize) -CIRCLE_NODE(DIV, luci::CircleDiv) -CIRCLE_NODE(ELU, luci::CircleElu) -CIRCLE_NODE(EQUAL, luci::CircleEqual) -CIRCLE_NODE(EXP, luci::CircleExp) -CIRCLE_NODE(EXPAND_DIMS, luci::CircleExpandDims) -CIRCLE_NODE(FAKE_QUANT, luci::CircleFakeQuant) -CIRCLE_NODE(FILL, luci::CircleFill) -CIRCLE_NODE(FLOOR, luci::CircleFloor) -CIRCLE_NODE(FLOOR_DIV, luci::CircleFloorDiv) -CIRCLE_NODE(FLOOR_MOD, luci::CircleFloorMod) -CIRCLE_NODE(FULLY_CONNECTED, luci::CircleFullyConnected) -CIRCLE_NODE(GATHER, luci::CircleGather) -CIRCLE_NODE(GATHER_ND, luci::CircleGatherNd) -CIRCLE_NODE(GREATER, luci::CircleGreater) -CIRCLE_NODE(GREATER_EQUAL, luci::CircleGreaterEqual) -CIRCLE_NODE(IF, luci::CircleIf) -CIRCLE_NODE(L2_NORMALIZATION, luci::CircleL2Normalize) -CIRCLE_NODE(L2_POOL_2D, luci::CircleL2Pool2D) -CIRCLE_NODE(LEAKY_RELU, luci::CircleLeakyRelu) -CIRCLE_NODE(LESS, luci::CircleLess) -CIRCLE_NODE(LESS_EQUAL, luci::CircleLessEqual) -CIRCLE_NODE(LOCAL_RESPONSE_NORMALIZATION, luci::CircleLocalResponseNormalization) -CIRCLE_NODE(LOG, luci::CircleLog) -CIRCLE_NODE(LOGICAL_AND, luci::CircleLogicalAnd) -CIRCLE_NODE(LOGICAL_NOT, luci::CircleLogicalNot) -CIRCLE_NODE(LOGICAL_OR, luci::CircleLogicalOr) -CIRCLE_NODE(LOGISTIC, luci::CircleLogistic) -CIRCLE_NODE(LOG_SOFTMAX, luci::CircleLogSoftmax) -CIRCLE_NODE(MATRIX_DIAG, luci::CircleMatrixDiag) -CIRCLE_NODE(MAX_POOL_2D, luci::CircleMaxPool2D) -CIRCLE_NODE(MATRIX_SET_DIAG, luci::CircleMatrixSetDiag) -CIRCLE_NODE(MAXIMUM, luci::CircleMaximum) -CIRCLE_NODE(MEAN, luci::CircleMean) -CIRCLE_NODE(MINIMUM, luci::CircleMinimum) -CIRCLE_NODE(MIRROR_PAD, luci::CircleMirrorPad) -CIRCLE_NODE(MUL, luci::CircleMul) -CIRCLE_NODE(NEG, luci::CircleNeg) -CIRCLE_NODE(NON_MAX_SUPPRESSION_V4, luci::CircleNonMaxSuppressionV4) -CIRCLE_NODE(NON_MAX_SUPPRESSION_V5, luci::CircleNonMaxSuppressionV5) -CIRCLE_NODE(NOT_EQUAL, luci::CircleNotEqual) -CIRCLE_NODE(ONE_HOT, luci::CircleOneHot) -CIRCLE_NODE(PACK, luci::CirclePack) -CIRCLE_NODE(PAD, luci::CirclePad) -CIRCLE_NODE(PADV2, luci::CirclePadV2) -CIRCLE_NODE(POW, luci::CirclePow) -CIRCLE_NODE(PRELU, luci::CirclePRelu) -CIRCLE_NODE(RANGE, luci::CircleRange) -CIRCLE_NODE(RANK, luci::CircleRank) -CIRCLE_NODE(REDUCE_ANY, luci::CircleReduceAny) -CIRCLE_NODE(REDUCE_MAX, luci::CircleReduceMax) -CIRCLE_NODE(REDUCE_MIN, luci::CircleReduceMin) -CIRCLE_NODE(REDUCE_PROD, luci::CircleReduceProd) -CIRCLE_NODE(RELU, luci::CircleRelu) -CIRCLE_NODE(RELU6, luci::CircleRelu6) -CIRCLE_NODE(RELU_N1_TO_1, luci::CircleReluN1To1) -CIRCLE_NODE(RESHAPE, luci::CircleReshape) -CIRCLE_NODE(RESIZE_BILINEAR, luci::CircleResizeBilinear) -CIRCLE_NODE(RESIZE_NEAREST_NEIGHBOR, luci::CircleResizeNearestNeighbor) -CIRCLE_NODE(REVERSE_SEQUENCE, luci::CircleReverseSequence) -CIRCLE_NODE(REVERSE_V2, luci::CircleReverseV2) -CIRCLE_NODE(ROUND, luci::CircleRound) -CIRCLE_NODE(RSQRT, luci::CircleRsqrt) -CIRCLE_NODE(SCATTER_ND, luci::CircleScatterNd) -CIRCLE_NODE(SEGMENT_SUM, luci::CircleSegmentSum) -CIRCLE_NODE(SELECT, luci::CircleSelect) -CIRCLE_NODE(SELECT_V2, luci::CircleSelectV2) -CIRCLE_NODE(SHAPE, luci::CircleShape) -CIRCLE_NODE(SIN, luci::CircleSin) -CIRCLE_NODE(SLICE, luci::CircleSlice) -CIRCLE_NODE(SOFTMAX, luci::CircleSoftmax) -CIRCLE_NODE(SPACE_TO_BATCH_ND, luci::CircleSpaceToBatchND) -CIRCLE_NODE(SPACE_TO_DEPTH, luci::CircleSpaceToDepth) -CIRCLE_NODE(SPARSE_TO_DENSE, luci::CircleSparseToDense) -CIRCLE_NODE(SPLIT, luci::CircleSplit) -CIRCLE_NODE(SPLIT_V, luci::CircleSplitV) -CIRCLE_NODE(SQRT, luci::CircleSqrt) -CIRCLE_NODE(SQUARE, luci::CircleSquare) -CIRCLE_NODE(SQUARED_DIFFERENCE, luci::CircleSquaredDifference) -CIRCLE_NODE(SQUEEZE, luci::CircleSqueeze) -CIRCLE_NODE(STRIDED_SLICE, luci::CircleStridedSlice) -CIRCLE_NODE(SUB, luci::CircleSub) -CIRCLE_NODE(SUM, luci::CircleSum) -CIRCLE_NODE(TANH, luci::CircleTanh) -CIRCLE_NODE(TILE, luci::CircleTile) -CIRCLE_NODE(TOPK_V2, luci::CircleTopKV2) -CIRCLE_NODE(TRANSPOSE, luci::CircleTranspose) -CIRCLE_NODE(TRANSPOSE_CONV, luci::CircleTransposeConv) -CIRCLE_NODE(UNIDIRECTIONAL_SEQUENCE_LSTM, luci::CircleUnidirectionalSequenceLSTM) -CIRCLE_NODE(UNIQUE, luci::CircleUnique) -CIRCLE_NODE(UNPACK, luci::CircleUnpack) -CIRCLE_NODE(WHERE, luci::CircleWhere) -CIRCLE_NODE(WHILE, luci::CircleWhile) -CIRCLE_NODE(ZEROS_LIKE, luci::CircleZerosLike) +CIRCLE_NODE(ABS, CircleAbs) +CIRCLE_NODE(ADD, CircleAdd) +CIRCLE_NODE(ADD_N, CircleAddN) +CIRCLE_NODE(ARG_MAX, CircleArgMax) +CIRCLE_NODE(ARG_MIN, CircleArgMin) +CIRCLE_NODE(AVERAGE_POOL_2D, CircleAveragePool2D) +CIRCLE_NODE(BATCH_TO_SPACE_ND, CircleBatchToSpaceND) +CIRCLE_NODE(BATCH_MATMUL, CircleBatchMatMul) +CIRCLE_NODE(BIDIRECTIONAL_SEQUENCE_LSTM, CircleBidirectionalSequenceLSTM) +CIRCLE_NODE(CAST, CircleCast) +CIRCLE_NODE(CEIL, CircleCeil) +CIRCLE_NODE(CONCATENATION, CircleConcatenation) +CIRCLE_NODE(CONV_2D, CircleConv2D) +CIRCLE_NODE(COS, CircleCos) +CIRCLE_NODE(CUSTOM, CircleCustom) +CIRCLE_NODE(DEPTH_TO_SPACE, CircleDepthToSpace) +CIRCLE_NODE(DEPTHWISE_CONV_2D, CircleDepthwiseConv2D) +CIRCLE_NODE(DEQUANTIZE, CircleDequantize) +CIRCLE_NODE(DIV, CircleDiv) +CIRCLE_NODE(ELU, CircleElu) +CIRCLE_NODE(EQUAL, CircleEqual) +CIRCLE_NODE(EXP, CircleExp) +CIRCLE_NODE(EXPAND_DIMS, CircleExpandDims) +CIRCLE_NODE(FAKE_QUANT, CircleFakeQuant) +CIRCLE_NODE(FILL, CircleFill) +CIRCLE_NODE(FLOOR, CircleFloor) +CIRCLE_NODE(FLOOR_DIV, CircleFloorDiv) +CIRCLE_NODE(FLOOR_MOD, CircleFloorMod) +CIRCLE_NODE(FULLY_CONNECTED, CircleFullyConnected) +CIRCLE_NODE(GATHER, CircleGather) +CIRCLE_NODE(GATHER_ND, CircleGatherNd) +CIRCLE_NODE(GREATER, CircleGreater) +CIRCLE_NODE(GREATER_EQUAL, CircleGreaterEqual) +CIRCLE_NODE(IF, CircleIf) +CIRCLE_NODE(L2_NORMALIZATION, CircleL2Normalize) +CIRCLE_NODE(L2_POOL_2D, CircleL2Pool2D) +CIRCLE_NODE(LEAKY_RELU, CircleLeakyRelu) +CIRCLE_NODE(LESS, CircleLess) +CIRCLE_NODE(LESS_EQUAL, CircleLessEqual) +CIRCLE_NODE(LOCAL_RESPONSE_NORMALIZATION, CircleLocalResponseNormalization) +CIRCLE_NODE(LOG, CircleLog) +CIRCLE_NODE(LOGICAL_AND, CircleLogicalAnd) +CIRCLE_NODE(LOGICAL_NOT, CircleLogicalNot) +CIRCLE_NODE(LOGICAL_OR, CircleLogicalOr) +CIRCLE_NODE(LOGISTIC, CircleLogistic) +CIRCLE_NODE(LOG_SOFTMAX, CircleLogSoftmax) +CIRCLE_NODE(MATRIX_DIAG, CircleMatrixDiag) +CIRCLE_NODE(MAX_POOL_2D, CircleMaxPool2D) +CIRCLE_NODE(MATRIX_SET_DIAG, CircleMatrixSetDiag) +CIRCLE_NODE(MAXIMUM, CircleMaximum) +CIRCLE_NODE(MEAN, CircleMean) +CIRCLE_NODE(MINIMUM, CircleMinimum) +CIRCLE_NODE(MIRROR_PAD, CircleMirrorPad) +CIRCLE_NODE(MUL, CircleMul) +CIRCLE_NODE(NEG, CircleNeg) +CIRCLE_NODE(NON_MAX_SUPPRESSION_V4, CircleNonMaxSuppressionV4) +CIRCLE_NODE(NON_MAX_SUPPRESSION_V5, CircleNonMaxSuppressionV5) +CIRCLE_NODE(NOT_EQUAL, CircleNotEqual) +CIRCLE_NODE(ONE_HOT, CircleOneHot) +CIRCLE_NODE(PACK, CirclePack) +CIRCLE_NODE(PAD, CirclePad) +CIRCLE_NODE(PADV2, CirclePadV2) +CIRCLE_NODE(POW, CirclePow) +CIRCLE_NODE(PRELU, CirclePRelu) +CIRCLE_NODE(QUANTIZE, CircleQuantize) +CIRCLE_NODE(RANGE, CircleRange) +CIRCLE_NODE(RANK, CircleRank) +CIRCLE_NODE(REDUCE_ANY, CircleReduceAny) +CIRCLE_NODE(REDUCE_MAX, CircleReduceMax) +CIRCLE_NODE(REDUCE_MIN, CircleReduceMin) +CIRCLE_NODE(REDUCE_PROD, CircleReduceProd) +CIRCLE_NODE(RELU, CircleRelu) +CIRCLE_NODE(RELU6, CircleRelu6) +CIRCLE_NODE(RELU_N1_TO_1, CircleReluN1To1) +CIRCLE_NODE(RESHAPE, CircleReshape) +CIRCLE_NODE(RESIZE_BILINEAR, CircleResizeBilinear) +CIRCLE_NODE(RESIZE_NEAREST_NEIGHBOR, CircleResizeNearestNeighbor) +CIRCLE_NODE(REVERSE_SEQUENCE, CircleReverseSequence) +CIRCLE_NODE(REVERSE_V2, CircleReverseV2) +CIRCLE_NODE(ROUND, CircleRound) +CIRCLE_NODE(RSQRT, CircleRsqrt) +CIRCLE_NODE(SCATTER_ND, CircleScatterNd) +CIRCLE_NODE(SEGMENT_SUM, CircleSegmentSum) +CIRCLE_NODE(SELECT, CircleSelect) +CIRCLE_NODE(SELECT_V2, CircleSelectV2) +CIRCLE_NODE(SHAPE, CircleShape) +CIRCLE_NODE(SIN, CircleSin) +CIRCLE_NODE(SLICE, CircleSlice) +CIRCLE_NODE(SOFTMAX, CircleSoftmax) +CIRCLE_NODE(SPACE_TO_BATCH_ND, CircleSpaceToBatchND) +CIRCLE_NODE(SPACE_TO_DEPTH, CircleSpaceToDepth) +CIRCLE_NODE(SPARSE_TO_DENSE, CircleSparseToDense) +CIRCLE_NODE(SPLIT, CircleSplit) +CIRCLE_NODE(SPLIT_V, CircleSplitV) +CIRCLE_NODE(SQRT, CircleSqrt) +CIRCLE_NODE(SQUARE, CircleSquare) +CIRCLE_NODE(SQUARED_DIFFERENCE, CircleSquaredDifference) +CIRCLE_NODE(SQUEEZE, CircleSqueeze) +CIRCLE_NODE(STRIDED_SLICE, CircleStridedSlice) +CIRCLE_NODE(SUB, CircleSub) +CIRCLE_NODE(SUM, CircleSum) +CIRCLE_NODE(TANH, CircleTanh) +CIRCLE_NODE(TILE, CircleTile) +CIRCLE_NODE(TOPK_V2, CircleTopKV2) +CIRCLE_NODE(TRANSPOSE, CircleTranspose) +CIRCLE_NODE(TRANSPOSE_CONV, CircleTransposeConv) +CIRCLE_NODE(UNIDIRECTIONAL_SEQUENCE_LSTM, CircleUnidirectionalSequenceLSTM) +CIRCLE_NODE(UNIQUE, CircleUnique) +CIRCLE_NODE(UNPACK, CircleUnpack) +CIRCLE_NODE(WHERE, CircleWhere) +CIRCLE_NODE(WHILE, CircleWhile) +CIRCLE_NODE(ZEROS_LIKE, CircleZerosLike) // Circle Only -CIRCLE_NODE(BCQ_FULLY_CONNECTED, luci::CircleBCQFullyConnected) -CIRCLE_NODE(BCQ_GATHER, luci::CircleBCQGather) -CIRCLE_NODE(INSTANCE_NORM, luci::CircleInstanceNorm) +CIRCLE_NODE(BCQ_FULLY_CONNECTED, CircleBCQFullyConnected) +CIRCLE_NODE(BCQ_GATHER, CircleBCQGather) +CIRCLE_NODE(INSTANCE_NORM, CircleInstanceNorm) // Virtual node(s) -CIRCLE_VNODE(CIRCLEBIDIRECTIONAL_SEQUENCE_LSTM_OUT, luci::CircleBidirectionalSequenceLSTMOut) -CIRCLE_VNODE(CIRCLECONST, luci::CircleConst) -CIRCLE_VNODE(CIRCLEINPUT, luci::CircleInput) -CIRCLE_VNODE(CIRCLEOUTPUT, luci::CircleOutput) -CIRCLE_VNODE(CIRCLEOUTPUTDUMMY, luci::CircleOutputDummy) -CIRCLE_VNODE(CIRCLEOUTPUTEXCLUDE, luci::CircleOutputExclude) -CIRCLE_VNODE(CIRCLECUSTOMOUT, luci::CircleCustomOut) -CIRCLE_VNODE(CIRCLEIFOUT, luci::CircleIfOut) -CIRCLE_VNODE(CIRCLENONMAXSUPPRESSIONV4OUT, luci::CircleNonMaxSuppressionV4Out) -CIRCLE_VNODE(CIRCLENONMAXSUPPRESSIONV5OUT, luci::CircleNonMaxSuppressionV5Out) -CIRCLE_VNODE(CIRCLESPLITOUT, luci::CircleSplitOut) -CIRCLE_VNODE(CIRCLESPLITVOUT, luci::CircleSplitVOut) -CIRCLE_VNODE(CIRCLETOPKV2OUT, luci::CircleTopKV2Out) -CIRCLE_VNODE(CIRCLEUNIQUEOUT, luci::CircleUniqueOut) -CIRCLE_VNODE(CIRCLEUNPACKOUT, luci::CircleUnpackOut) -CIRCLE_VNODE(CIRCLEWHILEOUT, luci::CircleWhileOut) +CIRCLE_VNODE(CIRCLEBIDIRECTIONAL_SEQUENCE_LSTM_OUT, CircleBidirectionalSequenceLSTMOut) +CIRCLE_VNODE(CIRCLECONST, CircleConst) +CIRCLE_VNODE(CIRCLEINPUT, CircleInput) +CIRCLE_VNODE(CIRCLEOUTPUT, CircleOutput) +CIRCLE_VNODE(CIRCLEOUTPUTDUMMY, CircleOutputDummy) +CIRCLE_VNODE(CIRCLEOUTPUTEXCLUDE, CircleOutputExclude) +CIRCLE_VNODE(CIRCLECUSTOMOUT, CircleCustomOut) +CIRCLE_VNODE(CIRCLEIFOUT, CircleIfOut) +CIRCLE_VNODE(CIRCLENONMAXSUPPRESSIONV4OUT, CircleNonMaxSuppressionV4Out) +CIRCLE_VNODE(CIRCLENONMAXSUPPRESSIONV5OUT, CircleNonMaxSuppressionV5Out) +CIRCLE_VNODE(CIRCLESPLITOUT, CircleSplitOut) +CIRCLE_VNODE(CIRCLESPLITVOUT, CircleSplitVOut) +CIRCLE_VNODE(CIRCLETOPKV2OUT, CircleTopKV2Out) +CIRCLE_VNODE(CIRCLEUNIQUEOUT, CircleUniqueOut) +CIRCLE_VNODE(CIRCLEUNPACKOUT, CircleUnpackOut) +CIRCLE_VNODE(CIRCLEWHILEOUT, CircleWhileOut) diff --git a/compiler/luci/lang/include/luci/IR/Module.h b/compiler/luci/lang/include/luci/IR/Module.h index 30eac59ce..75cf67905 100644 --- a/compiler/luci/lang/include/luci/IR/Module.h +++ b/compiler/luci/lang/include/luci/IR/Module.h @@ -19,6 +19,7 @@ #include +#include #include #include @@ -59,8 +60,27 @@ public: // TODO provide graph accessor with a name +public: + void source_table(const std::map &table) { _source_table = table; } + + const std::map &source_table(void) const { return _source_table; } + private: std::vector> _graphs; + +private: + /** + * @brief Metadata about source table for profiling + * + * @note Key is ID of node and value is name of node. + * + * If there was originally imported 'source_table' in circle model, + * the table will be stored as it is. + * Otherwise, new 'source_table' is created with imported nodes. + * + * Even if Module has multiple subgraphs, only first subgraph is considered. + */ + std::map _source_table; }; std::unique_ptr make_module(void); diff --git a/compiler/luci/lang/include/luci/IR/Nodes/CircleConst.h b/compiler/luci/lang/include/luci/IR/Nodes/CircleConst.h index e44363d14..3e9a274e0 100644 --- a/compiler/luci/lang/include/luci/IR/Nodes/CircleConst.h +++ b/compiler/luci/lang/include/luci/IR/Nodes/CircleConst.h @@ -44,6 +44,8 @@ public: private: std::vector _data; + // TODO use _data for STRING and remove _strings + std::vector _strings; // for STRING type }; } // namespace luci diff --git a/compiler/luci/lang/include/luci/IR/Nodes/CircleCustom.h b/compiler/luci/lang/include/luci/IR/Nodes/CircleCustom.h index b21cc679f..5709e2cd5 100644 --- a/compiler/luci/lang/include/luci/IR/Nodes/CircleCustom.h +++ b/compiler/luci/lang/include/luci/IR/Nodes/CircleCustom.h @@ -32,9 +32,8 @@ public: CircleCustom(uint32_t arity, uint32_t out) : VariadicArityNode>(arity), _output_count(out) { - // TODO Support when arity is 0 - assert(arity >= 1); - assert(out > 0); + // NOTE Custom can have 0 input or 0 output but not both + assert(arity != 0 || out != 0); } public: diff --git a/compiler/luci/lang/include/luci/IR/Nodes/CircleQuantize.h b/compiler/luci/lang/include/luci/IR/Nodes/CircleQuantize.h new file mode 100644 index 000000000..8018a76c2 --- /dev/null +++ b/compiler/luci/lang/include/luci/IR/Nodes/CircleQuantize.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021 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 __LUCI_IR_CIRCELEQUANTIZE_H__ +#define __LUCI_IR_CIRCELEQUANTIZE_H__ + +#include "luci/IR/CircleNodeDecl.h" +#include "luci/IR/CircleOpcode.h" + +#include "luci/IR/CircleNodeMixins.h" + +namespace luci +{ + +/** + * @brief QUANTIZE in Circle + */ +class CircleQuantize final : public FixedArityNode<1, CircleNodeImpl> +{ +public: + loco::Node *input(void) const { return at(0)->node(); } + void input(loco::Node *node) { at(0)->node(node); } +}; + +} // namespace luci + +#endif // __LUCI_IR_CIRCELEDUANTIZE_H__ -- cgit v1.2.3