From 0dc8806b151a670c4067d0eb7231f4c817b072c7 Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Fri, 3 Jan 2025 14:41:04 +0900 Subject: [PATCH] [luci/service] Remove useless null check (#14517) This commit removes null check created by loco::NodePool::create(). When node creation fails, it throws an exception instead of returning nullptr. ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh --- compiler/luci/service/src/Nodes/CircleAdd.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleArgMax.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleArgMin.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleAveragePool2D.cpp | 1 - compiler/luci/service/src/Nodes/CircleBCQFullyConnected.cpp | 1 - compiler/luci/service/src/Nodes/CircleBCQGather.cpp | 1 - compiler/luci/service/src/Nodes/CircleBatchMatMul.cpp | 1 - compiler/luci/service/src/Nodes/CircleCast.cpp | 1 - compiler/luci/service/src/Nodes/CircleConcatenation.cpp | 1 - compiler/luci/service/src/Nodes/CircleConst.cpp | 1 - compiler/luci/service/src/Nodes/CircleConv2D.cpp | 1 - compiler/luci/service/src/Nodes/CircleCustom.cpp | 1 - compiler/luci/service/src/Nodes/CircleCustomOut.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleDepthToSpace.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleDepthwiseConv2D.cpp | 1 - compiler/luci/service/src/Nodes/CircleDiv.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleFakeQuant.cpp | 1 - compiler/luci/service/src/Nodes/CircleFullyConnected.cpp | 1 - compiler/luci/service/src/Nodes/CircleGRU.cpp | 1 - compiler/luci/service/src/Nodes/CircleGather.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleGelu.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleIfOut.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleL2Normalize.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleL2Pool2D.cpp | 1 - compiler/luci/service/src/Nodes/CircleLeakyRelu.cpp | 3 +-- .../service/src/Nodes/CircleLocalResponseNormalization.cpp | 1 - compiler/luci/service/src/Nodes/CircleMaxPool2D.cpp | 1 - compiler/luci/service/src/Nodes/CircleMean.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleMirrorPad.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleMul.cpp | 3 +-- .../luci/service/src/Nodes/CircleNonMaxSuppressionV4Out.cpp | 3 +-- .../luci/service/src/Nodes/CircleNonMaxSuppressionV5Out.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleOneHot.cpp | 3 +-- compiler/luci/service/src/Nodes/CirclePack.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleReduceAny.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleReduceMax.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleReduceMin.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleReduceProd.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleReshape.cpp | 1 - compiler/luci/service/src/Nodes/CircleResizeBilinear.cpp | 1 - .../luci/service/src/Nodes/CircleResizeNearestNeighbor.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleReverseSequence.cpp | 1 - compiler/luci/service/src/Nodes/CircleRmsNorm.cpp | 1 - compiler/luci/service/src/Nodes/CircleSVDF.cpp | 1 - compiler/luci/service/src/Nodes/CircleShape.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleSoftmax.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleSpaceToDepth.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleSparseToDense.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleSplit.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleSplitOut.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleSplitV.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleSplitVOut.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleSqueeze.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleStridedSlice.cpp | 1 - compiler/luci/service/src/Nodes/CircleSub.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleSum.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleTopKV2Out.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleTransposeConv.cpp | 1 - .../service/src/Nodes/CircleUnidirectionalSequenceLSTM.cpp | 1 - compiler/luci/service/src/Nodes/CircleUnique.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleUniqueOut.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleUnpack.cpp | 1 - compiler/luci/service/src/Nodes/CircleUnpackOut.cpp | 3 +-- compiler/luci/service/src/Nodes/CircleWhileOut.cpp | 3 +-- 64 files changed, 39 insertions(+), 103 deletions(-) diff --git a/compiler/luci/service/src/Nodes/CircleAdd.cpp b/compiler/luci/service/src/Nodes/CircleAdd.cpp index 9c201f88055..0570d33a8a0 100644 --- a/compiler/luci/service/src/Nodes/CircleAdd.cpp +++ b/compiler/luci/service/src/Nodes/CircleAdd.cpp @@ -29,8 +29,7 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleAdd *node) return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->fusedActivationFunction(node->fusedActivationFunction()); + cloned->fusedActivationFunction(node->fusedActivationFunction()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleArgMax.cpp b/compiler/luci/service/src/Nodes/CircleArgMax.cpp index b6efc2feb4b..d36b19a00c1 100644 --- a/compiler/luci/service/src/Nodes/CircleArgMax.cpp +++ b/compiler/luci/service/src/Nodes/CircleArgMax.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleArgMax *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->output_type(node->output_type()); + cloned->output_type(node->output_type()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleArgMin.cpp b/compiler/luci/service/src/Nodes/CircleArgMin.cpp index ab079267ebf..be9f2b43e46 100644 --- a/compiler/luci/service/src/Nodes/CircleArgMin.cpp +++ b/compiler/luci/service/src/Nodes/CircleArgMin.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleArgMin *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->output_type(node->output_type()); + cloned->output_type(node->output_type()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleAveragePool2D.cpp b/compiler/luci/service/src/Nodes/CircleAveragePool2D.cpp index c64b1b86472..5e953a6f9a0 100644 --- a/compiler/luci/service/src/Nodes/CircleAveragePool2D.cpp +++ b/compiler/luci/service/src/Nodes/CircleAveragePool2D.cpp @@ -27,7 +27,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleAveragePool2D * return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->padding(node->padding()); diff --git a/compiler/luci/service/src/Nodes/CircleBCQFullyConnected.cpp b/compiler/luci/service/src/Nodes/CircleBCQFullyConnected.cpp index 3edc06ab8e2..24ce8a77b08 100644 --- a/compiler/luci/service/src/Nodes/CircleBCQFullyConnected.cpp +++ b/compiler/luci/service/src/Nodes/CircleBCQFullyConnected.cpp @@ -25,7 +25,6 @@ luci::CircleNode *CloneNode::visit(const luci::CircleBCQFullyConnected *node) return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->weights_hidden_size(node->weights_hidden_size()); diff --git a/compiler/luci/service/src/Nodes/CircleBCQGather.cpp b/compiler/luci/service/src/Nodes/CircleBCQGather.cpp index 35b6be7449f..f13a0e57df7 100644 --- a/compiler/luci/service/src/Nodes/CircleBCQGather.cpp +++ b/compiler/luci/service/src/Nodes/CircleBCQGather.cpp @@ -22,7 +22,6 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleBCQGather *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->axis(node->axis()); cloned->input_hidden_size(node->input_hidden_size()); diff --git a/compiler/luci/service/src/Nodes/CircleBatchMatMul.cpp b/compiler/luci/service/src/Nodes/CircleBatchMatMul.cpp index c5e0f1d9064..7385cd92700 100644 --- a/compiler/luci/service/src/Nodes/CircleBatchMatMul.cpp +++ b/compiler/luci/service/src/Nodes/CircleBatchMatMul.cpp @@ -68,7 +68,6 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleBatchMatMul *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->adj_x(node->adj_x()); cloned->adj_y(node->adj_y()); diff --git a/compiler/luci/service/src/Nodes/CircleCast.cpp b/compiler/luci/service/src/Nodes/CircleCast.cpp index 1c20152cce4..4800a0e8602 100644 --- a/compiler/luci/service/src/Nodes/CircleCast.cpp +++ b/compiler/luci/service/src/Nodes/CircleCast.cpp @@ -22,7 +22,6 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleCast *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->in_data_type(node->in_data_type()); cloned->out_data_type(node->out_data_type()); diff --git a/compiler/luci/service/src/Nodes/CircleConcatenation.cpp b/compiler/luci/service/src/Nodes/CircleConcatenation.cpp index 23a94adbaf2..30bdb8b2ada 100644 --- a/compiler/luci/service/src/Nodes/CircleConcatenation.cpp +++ b/compiler/luci/service/src/Nodes/CircleConcatenation.cpp @@ -29,7 +29,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleConcatenation * return nullptr; auto *cloned = _graph->nodes()->create(node->numValues()); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->axis(node->axis()); diff --git a/compiler/luci/service/src/Nodes/CircleConst.cpp b/compiler/luci/service/src/Nodes/CircleConst.cpp index c8f43c444cd..55fd0af4f07 100644 --- a/compiler/luci/service/src/Nodes/CircleConst.cpp +++ b/compiler/luci/service/src/Nodes/CircleConst.cpp @@ -46,7 +46,6 @@ luci::CircleConst *clone_circleconst(const luci::CircleConst *node, loco::Graph { auto cloned = graph->nodes()->create(); - if (cloned != nullptr) { // dtype/shape cloned->dtype(node->dtype()); diff --git a/compiler/luci/service/src/Nodes/CircleConv2D.cpp b/compiler/luci/service/src/Nodes/CircleConv2D.cpp index bd2a28988b4..686f63e83ca 100644 --- a/compiler/luci/service/src/Nodes/CircleConv2D.cpp +++ b/compiler/luci/service/src/Nodes/CircleConv2D.cpp @@ -27,7 +27,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleConv2D *node) return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->padding(node->padding()); diff --git a/compiler/luci/service/src/Nodes/CircleCustom.cpp b/compiler/luci/service/src/Nodes/CircleCustom.cpp index 9a99b192a20..efc068b1507 100644 --- a/compiler/luci/service/src/Nodes/CircleCustom.cpp +++ b/compiler/luci/service/src/Nodes/CircleCustom.cpp @@ -24,7 +24,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleCustom *node) uint32_t num_in = node->numInputs(); uint32_t num_out = node->numOutputs(); auto *cloned = _graph->nodes()->create(num_in, num_out); - if (cloned != nullptr) { cloned->custom_options(node->custom_options()); cloned->custom_code(node->custom_code()); diff --git a/compiler/luci/service/src/Nodes/CircleCustomOut.cpp b/compiler/luci/service/src/Nodes/CircleCustomOut.cpp index 84577f52984..7b781b6ae30 100644 --- a/compiler/luci/service/src/Nodes/CircleCustomOut.cpp +++ b/compiler/luci/service/src/Nodes/CircleCustomOut.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleCustomOut *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleDepthToSpace.cpp b/compiler/luci/service/src/Nodes/CircleDepthToSpace.cpp index 6b5705a0e8d..df0c91bb2e1 100644 --- a/compiler/luci/service/src/Nodes/CircleDepthToSpace.cpp +++ b/compiler/luci/service/src/Nodes/CircleDepthToSpace.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleDepthToSpace *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->block_size(node->block_size()); + cloned->block_size(node->block_size()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleDepthwiseConv2D.cpp b/compiler/luci/service/src/Nodes/CircleDepthwiseConv2D.cpp index ba34a221c80..701da127447 100644 --- a/compiler/luci/service/src/Nodes/CircleDepthwiseConv2D.cpp +++ b/compiler/luci/service/src/Nodes/CircleDepthwiseConv2D.cpp @@ -27,7 +27,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleDepthwiseConv2D return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->padding(node->padding()); diff --git a/compiler/luci/service/src/Nodes/CircleDiv.cpp b/compiler/luci/service/src/Nodes/CircleDiv.cpp index 7c760a50d66..f5c022311c0 100644 --- a/compiler/luci/service/src/Nodes/CircleDiv.cpp +++ b/compiler/luci/service/src/Nodes/CircleDiv.cpp @@ -29,8 +29,7 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleDiv *node) return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->fusedActivationFunction(node->fusedActivationFunction()); + cloned->fusedActivationFunction(node->fusedActivationFunction()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleFakeQuant.cpp b/compiler/luci/service/src/Nodes/CircleFakeQuant.cpp index 8e0150b0721..ab92070079b 100644 --- a/compiler/luci/service/src/Nodes/CircleFakeQuant.cpp +++ b/compiler/luci/service/src/Nodes/CircleFakeQuant.cpp @@ -22,7 +22,6 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleFakeQuant *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->min(node->min()); cloned->max(node->max()); diff --git a/compiler/luci/service/src/Nodes/CircleFullyConnected.cpp b/compiler/luci/service/src/Nodes/CircleFullyConnected.cpp index d7da18e0747..04d948205fb 100644 --- a/compiler/luci/service/src/Nodes/CircleFullyConnected.cpp +++ b/compiler/luci/service/src/Nodes/CircleFullyConnected.cpp @@ -31,7 +31,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleFullyConnected return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->weights_format(node->weights_format()); diff --git a/compiler/luci/service/src/Nodes/CircleGRU.cpp b/compiler/luci/service/src/Nodes/CircleGRU.cpp index f39e4aaae96..3d650efe61c 100644 --- a/compiler/luci/service/src/Nodes/CircleGRU.cpp +++ b/compiler/luci/service/src/Nodes/CircleGRU.cpp @@ -25,7 +25,6 @@ luci::CircleNode *CloneNode::visit(const luci::CircleGRU *node) return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->returnSequences(node->returnSequences()); diff --git a/compiler/luci/service/src/Nodes/CircleGather.cpp b/compiler/luci/service/src/Nodes/CircleGather.cpp index 66fc90dd70a..7ab95e65ddf 100644 --- a/compiler/luci/service/src/Nodes/CircleGather.cpp +++ b/compiler/luci/service/src/Nodes/CircleGather.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleGather *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->axis(node->axis()); + cloned->axis(node->axis()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleGelu.cpp b/compiler/luci/service/src/Nodes/CircleGelu.cpp index 62a0d409488..f3554563986 100644 --- a/compiler/luci/service/src/Nodes/CircleGelu.cpp +++ b/compiler/luci/service/src/Nodes/CircleGelu.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleGelu *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->approximate(node->approximate()); + cloned->approximate(node->approximate()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleIfOut.cpp b/compiler/luci/service/src/Nodes/CircleIfOut.cpp index 74b9af48baa..65732a99052 100644 --- a/compiler/luci/service/src/Nodes/CircleIfOut.cpp +++ b/compiler/luci/service/src/Nodes/CircleIfOut.cpp @@ -100,8 +100,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleIfOut *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleL2Normalize.cpp b/compiler/luci/service/src/Nodes/CircleL2Normalize.cpp index 6a9f61f8241..02869dd10a0 100644 --- a/compiler/luci/service/src/Nodes/CircleL2Normalize.cpp +++ b/compiler/luci/service/src/Nodes/CircleL2Normalize.cpp @@ -25,8 +25,7 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleL2Normalize *n return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->fusedActivationFunction(node->fusedActivationFunction()); + cloned->fusedActivationFunction(node->fusedActivationFunction()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleL2Pool2D.cpp b/compiler/luci/service/src/Nodes/CircleL2Pool2D.cpp index 532b3623716..6369eefef7e 100644 --- a/compiler/luci/service/src/Nodes/CircleL2Pool2D.cpp +++ b/compiler/luci/service/src/Nodes/CircleL2Pool2D.cpp @@ -27,7 +27,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleL2Pool2D *node return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->padding(node->padding()); diff --git a/compiler/luci/service/src/Nodes/CircleLeakyRelu.cpp b/compiler/luci/service/src/Nodes/CircleLeakyRelu.cpp index 0432bbcfc09..525b5a9103b 100644 --- a/compiler/luci/service/src/Nodes/CircleLeakyRelu.cpp +++ b/compiler/luci/service/src/Nodes/CircleLeakyRelu.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleLeakyRelu *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->alpha(node->alpha()); + cloned->alpha(node->alpha()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleLocalResponseNormalization.cpp b/compiler/luci/service/src/Nodes/CircleLocalResponseNormalization.cpp index 7e5f7a99322..806b2d0d519 100644 --- a/compiler/luci/service/src/Nodes/CircleLocalResponseNormalization.cpp +++ b/compiler/luci/service/src/Nodes/CircleLocalResponseNormalization.cpp @@ -22,7 +22,6 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleLocalResponseNormalization *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->radius(node->radius()); cloned->bias(node->bias()); diff --git a/compiler/luci/service/src/Nodes/CircleMaxPool2D.cpp b/compiler/luci/service/src/Nodes/CircleMaxPool2D.cpp index 8b186094dae..69acade1127 100644 --- a/compiler/luci/service/src/Nodes/CircleMaxPool2D.cpp +++ b/compiler/luci/service/src/Nodes/CircleMaxPool2D.cpp @@ -27,7 +27,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleMaxPool2D *nod return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->padding(node->padding()); diff --git a/compiler/luci/service/src/Nodes/CircleMean.cpp b/compiler/luci/service/src/Nodes/CircleMean.cpp index 217735693ae..9f61dd2ad86 100644 --- a/compiler/luci/service/src/Nodes/CircleMean.cpp +++ b/compiler/luci/service/src/Nodes/CircleMean.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleMean *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->keep_dims(node->keep_dims()); + cloned->keep_dims(node->keep_dims()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleMirrorPad.cpp b/compiler/luci/service/src/Nodes/CircleMirrorPad.cpp index 8bc186a6b46..354cb44ea28 100644 --- a/compiler/luci/service/src/Nodes/CircleMirrorPad.cpp +++ b/compiler/luci/service/src/Nodes/CircleMirrorPad.cpp @@ -25,8 +25,7 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleMirrorPad *nod return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->mode(node->mode()); + cloned->mode(node->mode()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleMul.cpp b/compiler/luci/service/src/Nodes/CircleMul.cpp index 4ea1e4ef26e..201bffa5b01 100644 --- a/compiler/luci/service/src/Nodes/CircleMul.cpp +++ b/compiler/luci/service/src/Nodes/CircleMul.cpp @@ -28,8 +28,7 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleMul *node) return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->fusedActivationFunction(node->fusedActivationFunction()); + cloned->fusedActivationFunction(node->fusedActivationFunction()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleNonMaxSuppressionV4Out.cpp b/compiler/luci/service/src/Nodes/CircleNonMaxSuppressionV4Out.cpp index 2a12f2a45ae..eb26e15eb7e 100644 --- a/compiler/luci/service/src/Nodes/CircleNonMaxSuppressionV4Out.cpp +++ b/compiler/luci/service/src/Nodes/CircleNonMaxSuppressionV4Out.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleNonMaxSuppressionV4Out *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleNonMaxSuppressionV5Out.cpp b/compiler/luci/service/src/Nodes/CircleNonMaxSuppressionV5Out.cpp index e1d7875e7aa..e41524d1cd4 100644 --- a/compiler/luci/service/src/Nodes/CircleNonMaxSuppressionV5Out.cpp +++ b/compiler/luci/service/src/Nodes/CircleNonMaxSuppressionV5Out.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleNonMaxSuppressionV5Out *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleOneHot.cpp b/compiler/luci/service/src/Nodes/CircleOneHot.cpp index c68ab9242f9..5ecf8b7e80b 100644 --- a/compiler/luci/service/src/Nodes/CircleOneHot.cpp +++ b/compiler/luci/service/src/Nodes/CircleOneHot.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleOneHot *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->axis(node->axis()); + cloned->axis(node->axis()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CirclePack.cpp b/compiler/luci/service/src/Nodes/CirclePack.cpp index fccbd0f8c58..88edb814d10 100644 --- a/compiler/luci/service/src/Nodes/CirclePack.cpp +++ b/compiler/luci/service/src/Nodes/CirclePack.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CirclePack *node) { auto *cloned = _graph->nodes()->create(node->values_count()); - if (cloned != nullptr) - cloned->axis(node->axis()); + cloned->axis(node->axis()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleReduceAny.cpp b/compiler/luci/service/src/Nodes/CircleReduceAny.cpp index c29755ec500..2b3e00b6903 100644 --- a/compiler/luci/service/src/Nodes/CircleReduceAny.cpp +++ b/compiler/luci/service/src/Nodes/CircleReduceAny.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleReduceAny *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->keep_dims(node->keep_dims()); + cloned->keep_dims(node->keep_dims()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleReduceMax.cpp b/compiler/luci/service/src/Nodes/CircleReduceMax.cpp index efe30491ece..0992c617fad 100644 --- a/compiler/luci/service/src/Nodes/CircleReduceMax.cpp +++ b/compiler/luci/service/src/Nodes/CircleReduceMax.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleReduceMax *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->keep_dims(node->keep_dims()); + cloned->keep_dims(node->keep_dims()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleReduceMin.cpp b/compiler/luci/service/src/Nodes/CircleReduceMin.cpp index e1e38e38e22..76d61bfde96 100644 --- a/compiler/luci/service/src/Nodes/CircleReduceMin.cpp +++ b/compiler/luci/service/src/Nodes/CircleReduceMin.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleReduceMin *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->keep_dims(node->keep_dims()); + cloned->keep_dims(node->keep_dims()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleReduceProd.cpp b/compiler/luci/service/src/Nodes/CircleReduceProd.cpp index 3d51c6929a3..77614c4cbe1 100644 --- a/compiler/luci/service/src/Nodes/CircleReduceProd.cpp +++ b/compiler/luci/service/src/Nodes/CircleReduceProd.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleReduceProd *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->keep_dims(node->keep_dims()); + cloned->keep_dims(node->keep_dims()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleReshape.cpp b/compiler/luci/service/src/Nodes/CircleReshape.cpp index 025ad4912a1..0450ba8358d 100644 --- a/compiler/luci/service/src/Nodes/CircleReshape.cpp +++ b/compiler/luci/service/src/Nodes/CircleReshape.cpp @@ -52,7 +52,6 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleReshape *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { uint32_t rank = node->newShape()->rank(); cloned->newShape()->rank(rank); diff --git a/compiler/luci/service/src/Nodes/CircleResizeBilinear.cpp b/compiler/luci/service/src/Nodes/CircleResizeBilinear.cpp index f77d3e21638..961e8dafa95 100644 --- a/compiler/luci/service/src/Nodes/CircleResizeBilinear.cpp +++ b/compiler/luci/service/src/Nodes/CircleResizeBilinear.cpp @@ -22,7 +22,6 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleResizeBilinear *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->align_corners(node->align_corners()); cloned->half_pixel_centers(node->half_pixel_centers()); diff --git a/compiler/luci/service/src/Nodes/CircleResizeNearestNeighbor.cpp b/compiler/luci/service/src/Nodes/CircleResizeNearestNeighbor.cpp index cfb396392d9..069a0f0d442 100644 --- a/compiler/luci/service/src/Nodes/CircleResizeNearestNeighbor.cpp +++ b/compiler/luci/service/src/Nodes/CircleResizeNearestNeighbor.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleResizeNearestNeighbor *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->align_corners(node->align_corners()); + cloned->align_corners(node->align_corners()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleReverseSequence.cpp b/compiler/luci/service/src/Nodes/CircleReverseSequence.cpp index 682ad110516..809f34c3c5d 100644 --- a/compiler/luci/service/src/Nodes/CircleReverseSequence.cpp +++ b/compiler/luci/service/src/Nodes/CircleReverseSequence.cpp @@ -22,7 +22,6 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleReverseSequence *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->seq_axis(node->seq_axis()); cloned->batch_axis(node->batch_axis()); diff --git a/compiler/luci/service/src/Nodes/CircleRmsNorm.cpp b/compiler/luci/service/src/Nodes/CircleRmsNorm.cpp index 0fdf2bdf3d8..1ae72e8d04a 100644 --- a/compiler/luci/service/src/Nodes/CircleRmsNorm.cpp +++ b/compiler/luci/service/src/Nodes/CircleRmsNorm.cpp @@ -22,7 +22,6 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleRmsNorm *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->epsilon(node->epsilon()); } diff --git a/compiler/luci/service/src/Nodes/CircleSVDF.cpp b/compiler/luci/service/src/Nodes/CircleSVDF.cpp index d4c3ce88f8c..0fe63d1df6b 100644 --- a/compiler/luci/service/src/Nodes/CircleSVDF.cpp +++ b/compiler/luci/service/src/Nodes/CircleSVDF.cpp @@ -25,7 +25,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleSVDF *node) return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->asymmetric_quantize_inputs(node->asymmetric_quantize_inputs()); diff --git a/compiler/luci/service/src/Nodes/CircleShape.cpp b/compiler/luci/service/src/Nodes/CircleShape.cpp index 9ae742091b6..da93ad9913c 100644 --- a/compiler/luci/service/src/Nodes/CircleShape.cpp +++ b/compiler/luci/service/src/Nodes/CircleShape.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleShape *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->out_type(node->out_type()); + cloned->out_type(node->out_type()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleSoftmax.cpp b/compiler/luci/service/src/Nodes/CircleSoftmax.cpp index a2c99900d29..64fab0fd75a 100644 --- a/compiler/luci/service/src/Nodes/CircleSoftmax.cpp +++ b/compiler/luci/service/src/Nodes/CircleSoftmax.cpp @@ -25,8 +25,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleSoftmax *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->beta(node->beta()); + cloned->beta(node->beta()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleSpaceToDepth.cpp b/compiler/luci/service/src/Nodes/CircleSpaceToDepth.cpp index 7916acf6b29..11d5ee3a915 100644 --- a/compiler/luci/service/src/Nodes/CircleSpaceToDepth.cpp +++ b/compiler/luci/service/src/Nodes/CircleSpaceToDepth.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleSpaceToDepth *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->block_size(node->block_size()); + cloned->block_size(node->block_size()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleSparseToDense.cpp b/compiler/luci/service/src/Nodes/CircleSparseToDense.cpp index 8218e9244a3..18201259db6 100644 --- a/compiler/luci/service/src/Nodes/CircleSparseToDense.cpp +++ b/compiler/luci/service/src/Nodes/CircleSparseToDense.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleSparseToDense *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->validate_indices(node->validate_indices()); + cloned->validate_indices(node->validate_indices()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleSplit.cpp b/compiler/luci/service/src/Nodes/CircleSplit.cpp index 91aaa5547eb..bf85f464f63 100644 --- a/compiler/luci/service/src/Nodes/CircleSplit.cpp +++ b/compiler/luci/service/src/Nodes/CircleSplit.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleSplit *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->num_split(node->num_split()); + cloned->num_split(node->num_split()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleSplitOut.cpp b/compiler/luci/service/src/Nodes/CircleSplitOut.cpp index 02459889280..ffb317dc83c 100644 --- a/compiler/luci/service/src/Nodes/CircleSplitOut.cpp +++ b/compiler/luci/service/src/Nodes/CircleSplitOut.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleSplitOut *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleSplitV.cpp b/compiler/luci/service/src/Nodes/CircleSplitV.cpp index 18095b049b6..7e73e09aa5b 100644 --- a/compiler/luci/service/src/Nodes/CircleSplitV.cpp +++ b/compiler/luci/service/src/Nodes/CircleSplitV.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleSplitV *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->num_split(node->num_split()); + cloned->num_split(node->num_split()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleSplitVOut.cpp b/compiler/luci/service/src/Nodes/CircleSplitVOut.cpp index f40eb0a4759..3396676b713 100644 --- a/compiler/luci/service/src/Nodes/CircleSplitVOut.cpp +++ b/compiler/luci/service/src/Nodes/CircleSplitVOut.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleSplitVOut *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleSqueeze.cpp b/compiler/luci/service/src/Nodes/CircleSqueeze.cpp index 384ee52c5c2..94516bf87ad 100644 --- a/compiler/luci/service/src/Nodes/CircleSqueeze.cpp +++ b/compiler/luci/service/src/Nodes/CircleSqueeze.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleSqueeze *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->squeeze_dims(node->squeeze_dims()); + cloned->squeeze_dims(node->squeeze_dims()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleStridedSlice.cpp b/compiler/luci/service/src/Nodes/CircleStridedSlice.cpp index 09543a5bf92..769a0d037d2 100644 --- a/compiler/luci/service/src/Nodes/CircleStridedSlice.cpp +++ b/compiler/luci/service/src/Nodes/CircleStridedSlice.cpp @@ -36,7 +36,6 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleStridedSlice *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->begin_mask(node->begin_mask()); cloned->end_mask(node->end_mask()); diff --git a/compiler/luci/service/src/Nodes/CircleSub.cpp b/compiler/luci/service/src/Nodes/CircleSub.cpp index 3084740cc17..329679b20c9 100644 --- a/compiler/luci/service/src/Nodes/CircleSub.cpp +++ b/compiler/luci/service/src/Nodes/CircleSub.cpp @@ -25,8 +25,7 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleSub *node) return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->fusedActivationFunction(node->fusedActivationFunction()); + cloned->fusedActivationFunction(node->fusedActivationFunction()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleSum.cpp b/compiler/luci/service/src/Nodes/CircleSum.cpp index 1d5882afb71..e69dd8df755 100644 --- a/compiler/luci/service/src/Nodes/CircleSum.cpp +++ b/compiler/luci/service/src/Nodes/CircleSum.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleSum *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->keep_dims(node->keep_dims()); + cloned->keep_dims(node->keep_dims()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleTopKV2Out.cpp b/compiler/luci/service/src/Nodes/CircleTopKV2Out.cpp index 5c13f2be154..97cadcd8c23 100644 --- a/compiler/luci/service/src/Nodes/CircleTopKV2Out.cpp +++ b/compiler/luci/service/src/Nodes/CircleTopKV2Out.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleTopKV2Out *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleTransposeConv.cpp b/compiler/luci/service/src/Nodes/CircleTransposeConv.cpp index 73aad2eb6df..811aa6b6e7b 100644 --- a/compiler/luci/service/src/Nodes/CircleTransposeConv.cpp +++ b/compiler/luci/service/src/Nodes/CircleTransposeConv.cpp @@ -25,7 +25,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleTransposeConv return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->padding(node->padding()); cloned->stride()->h(node->stride()->h()); diff --git a/compiler/luci/service/src/Nodes/CircleUnidirectionalSequenceLSTM.cpp b/compiler/luci/service/src/Nodes/CircleUnidirectionalSequenceLSTM.cpp index 7e03d9a1b1d..5abcf233c25 100644 --- a/compiler/luci/service/src/Nodes/CircleUnidirectionalSequenceLSTM.cpp +++ b/compiler/luci/service/src/Nodes/CircleUnidirectionalSequenceLSTM.cpp @@ -25,7 +25,6 @@ luci::CircleNode *CloneNodeLet::visit(const luci::CircleUnidirectional return nullptr; auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->fusedActivationFunction(node->fusedActivationFunction()); cloned->cell_clip(node->cell_clip()); diff --git a/compiler/luci/service/src/Nodes/CircleUnique.cpp b/compiler/luci/service/src/Nodes/CircleUnique.cpp index fb191e1c6d9..5eb8bc7cae1 100644 --- a/compiler/luci/service/src/Nodes/CircleUnique.cpp +++ b/compiler/luci/service/src/Nodes/CircleUnique.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleUnique *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->idx_out_type(node->idx_out_type()); + cloned->idx_out_type(node->idx_out_type()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleUniqueOut.cpp b/compiler/luci/service/src/Nodes/CircleUniqueOut.cpp index 30093f9db4c..963247e69b6 100644 --- a/compiler/luci/service/src/Nodes/CircleUniqueOut.cpp +++ b/compiler/luci/service/src/Nodes/CircleUniqueOut.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleUniqueOut *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleUnpack.cpp b/compiler/luci/service/src/Nodes/CircleUnpack.cpp index 4c90640c818..f0c3c33938c 100644 --- a/compiler/luci/service/src/Nodes/CircleUnpack.cpp +++ b/compiler/luci/service/src/Nodes/CircleUnpack.cpp @@ -22,7 +22,6 @@ namespace luci luci::CircleNode *CloneNodeLet::visit(const luci::CircleUnpack *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) { cloned->num(node->num()); cloned->axis(node->axis()); diff --git a/compiler/luci/service/src/Nodes/CircleUnpackOut.cpp b/compiler/luci/service/src/Nodes/CircleUnpackOut.cpp index 342d5daca07..ef8ec2c0e92 100644 --- a/compiler/luci/service/src/Nodes/CircleUnpackOut.cpp +++ b/compiler/luci/service/src/Nodes/CircleUnpackOut.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleUnpackOut *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; } diff --git a/compiler/luci/service/src/Nodes/CircleWhileOut.cpp b/compiler/luci/service/src/Nodes/CircleWhileOut.cpp index 52075a1b869..3eabe1cb53e 100644 --- a/compiler/luci/service/src/Nodes/CircleWhileOut.cpp +++ b/compiler/luci/service/src/Nodes/CircleWhileOut.cpp @@ -22,8 +22,7 @@ namespace luci luci::CircleNode *CloneNode::visit(const luci::CircleWhileOut *node) { auto *cloned = _graph->nodes()->create(); - if (cloned != nullptr) - cloned->index(node->index()); + cloned->index(node->index()); return cloned; }