Removed unwanted ternary operators
authorAdwaith Anand <adwaith.a@samsung.com>
Fri, 4 Aug 2023 14:30:47 +0000 (20:00 +0530)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 9 Aug 2023 00:54:45 +0000 (09:54 +0900)
Ternary operators which was used in assignment of boolean values is
removed since it was redundant.

Signed-off-by: Adwaith Anand <adwaith.a@samsung.com>
nntrainer/layers/fc_layer.cpp
nntrainer/tensor/tensor.cpp

index afe228e..ca5c70b 100644 (file)
@@ -66,7 +66,7 @@ void FullyConnectedLayer::finalize(InitLayerContext &context) {
   context.setEffDimFlagInputDimension(0, 0b1001);
   context.setDynDimFlagInputDimension(0, 0b1000);
 
-  bool is_nchw = (getTensorType() == Tformat::NCHW) ? true : false;
+  bool is_nchw = (getTensorType() == Tformat::NCHW);
   /** set output dimensions */
   auto const &in_dim = context.getInputDimensions()[0];
   output_dims[0] = in_dim;
index 0d46222..afb9323 100644 (file)
@@ -927,7 +927,7 @@ std::vector<Tensor> Tensor::split(std::vector<size_t> sizes, int axis) {
     ret_dims[i].setTensorDim(axis, sizes[i]);
   }
 
-  bool is_format_nchw = (dim.getFormat() == Tformat::NCHW) ? true : false;
+  bool is_format_nchw = (dim.getFormat() == Tformat::NCHW);
 
   auto iter_value = [this, is_format_nchw](
                       std::array<size_t, 4> &loc,
@@ -1022,7 +1022,7 @@ Tensor Tensor::cat(const std::vector<Tensor> &tensors, int axis) {
     << "given tensor vector is empty";
 
   auto ref_dim = tensors.front().getDim();
-  bool is_format_nchw = (ref_dim.getFormat() == Tformat::NCHW) ? true : false;
+  bool is_format_nchw = (ref_dim.getFormat() == Tformat::NCHW);
   ref_dim.setTensorDim(axis, 1);
   NNTR_THROW_IF(!std::all_of(tensors.begin(), tensors.end(),
                              [&ref_dim, axis](const Tensor &t) {
@@ -1611,7 +1611,7 @@ Tensor &Tensor::transpose(const std::string &direction, Tensor &out) const {
 
   SL = dim.batch(), SI = dim.channel(), SJ = dim.height(), SK = dim.width();
 
-  bool is_format_nchw = (getFormat() == Tformat::NCHW) ? true : false;
+  bool is_format_nchw = (getFormat() == Tformat::NCHW);
 
   inptr = getData();
   outptr = out.getData();