diff --git a/src/operator/Stack.cpp b/src/operator/Stack.cpp index 8833cac3c8d142042a792edcd9e5280c41bc38ad..bae984f09dbfdd51bfa298fb37b8f829d55a506c 100644 --- a/src/operator/Stack.cpp +++ b/src/operator/Stack.cpp @@ -22,6 +22,8 @@ namespace Aidge { +// TODO: Check why getRequiredMemory is always called with empty vector as +// inputSize Aidge::Elts_t Aidge::StackProdConso::getRequiredMemory( const Aidge::IOIndex_t inputIdx, const std::vector<DimSize_t> &inputsSize) const { @@ -39,7 +41,8 @@ void StackOpImpl::forward() { const StackOp &op = dynamic_cast<const StackOp &>(mOp); AIDGE_ASSERT(op.getInput(0), "missing input #0"); AIDGE_ASSERT((op.forwardStep() < op.maxElements()), - "cannot forward anymore, maximum number of elements to stack exceeded"); + "cannot forward anymore, maximum number of elements to stack " + "exceeded"); op.getOutput(0)->getImpl()->copy( op.getInput(0)->getImpl()->rawPtr(), @@ -53,7 +56,9 @@ StackOp::StackOp(std::uint32_t maxElements) attr<StackAttr::MaxElements>(maxElements), attr<StackAttr::ForwardStep>(0))) { if (maxElements == 0) { - AIDGE_THROW_OR_ABORT(std::invalid_argument, "StackOp creation failed: maxElements must be greater than 0."); + AIDGE_THROW_OR_ABORT( + std::invalid_argument, + "StackOp creation failed: maxElements must be greater than 0."); } mImpl = std::make_shared<StackOpImpl>(*this); } diff --git a/unit_tests/operator/Test_StackImpl.cpp b/unit_tests/operator/Test_StackImpl.cpp index 521e365d718a491dbc9c12972d67ee3c8045c3eb..d853a1ba27fea0a071c1c2373bbd7ef7f4eacd11 100644 --- a/unit_tests/operator/Test_StackImpl.cpp +++ b/unit_tests/operator/Test_StackImpl.cpp @@ -140,7 +140,8 @@ TEST_CASE("[core/operator] Stack(forward)", "[Stack]") { for (std::size_t i = 0; i < numTensors; ++i) { Tensor outputTensor = output->extract( {static_cast<std::uint64_t>(static_cast<int>(i))}); - Tensor inputTensor(DataType::Float32); inputTensor.resize(dimsIn); + Tensor inputTensor(DataType::Float32); + inputTensor.resize(dimsIn); inputTensor.setBackend("cpu"); inputTensor.getImpl()->setRawPtr(arrays[i], nbElems); @@ -152,16 +153,14 @@ TEST_CASE("[core/operator] Stack(forward)", "[Stack]") { extraTensor->resize(dimsIn); extraTensor->setBackend("cpu"); extraTensor->setDataType(DataType::Float32); - float* extraArray = new float[nbElems]; + float *extraArray = new float[nbElems]; for (std::size_t j = 0; j < nbElems; ++j) { extraArray[j] = valueDist(gen); } extraTensor->getImpl()->setRawPtr(extraArray, nbElems); - REQUIRE_THROWS_AS( - (op->associateInput(0, extraTensor), op->forward()), - std::runtime_error - ); + REQUIRE_THROWS_AS((op->associateInput(0, extraTensor), op->forward()), + std::runtime_error); // Clean up delete[] extraArray;