diff --git a/src/operator/Gather.cpp b/src/operator/Gather.cpp index 920f161e4c6d916bcd127bc26e8cda49e5d592a7..1286ab2821fbb583ecaa18e1a7320c56e000849c 100644 --- a/src/operator/Gather.cpp +++ b/src/operator/Gather.cpp @@ -22,10 +22,13 @@ const std::string Aidge::Gather_Op::Type = "Gather"; void Aidge::Gather_Op::computeOutputDims() { // check inputs have been associated - if (!getInput(0) || !getInput(1)) { - AIDGE_THROW_OR_ABORT(std::runtime_error, "At least one input was not connected"); + for(int i=0; i<2; ++i){ + if (!getInput(i)) { + AIDGE_THROW_OR_ABORT(std::runtime_error, "{}: input #{} should be associated with a Tensor", type(), i); + } } + if (!getInput(0)->empty() && !getInput(1)->empty()) { std::vector<DimSize_t> outDims = getInput(0)->dims(); std::vector<DimSize_t> indicesDims = getInput(1)->dims(); diff --git a/src/operator/Slice.cpp b/src/operator/Slice.cpp index 3062895b76711dedd40af45efa59c067bbdf7f8e..d8b710e1c3de6a2bfa9e824833ee7b3487e1a74a 100644 --- a/src/operator/Slice.cpp +++ b/src/operator/Slice.cpp @@ -24,9 +24,11 @@ const std::string Aidge::Slice_Op::Type = "Slice"; void Aidge::Slice_Op::computeOutputDims() { - // check input have been associated - if (!getInput(0) || !getInput(1) || !getInput(2) || !getInput(3)) { - AIDGE_THROW_OR_ABORT(std::runtime_error, "Every input should be associated with a Tensor"); + // check inputs have been associated + for(int i=0; i<4; ++i){ + if (!getInput(i)) { + AIDGE_THROW_OR_ABORT(std::runtime_error, "{}: input #{} should be associated with a Tensor", type(), i); + } } if((!getInput(0)->empty()) && (!getInput(1)->empty()) && (!getInput(2)->empty()) && (!getInput(3)->empty()))