Skip to content
Snippets Groups Projects
Commit 85420931 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Clarified shape errors

parent e9be8063
No related branches found
No related tags found
1 merge request!1190.2.1
Pipeline #44905 passed
...@@ -63,7 +63,8 @@ bool Aidge::Add_Op::forwardDims(bool /*allowDataDependency*/) { ...@@ -63,7 +63,8 @@ bool Aidge::Add_Op::forwardDims(bool /*allowDataDependency*/) {
*it = dim; *it = dim;
} }
else if ((dim != *it) && (dim != 1)) { else if ((dim != *it) && (dim != 1)) {
AIDGE_THROW_OR_ABORT(std::runtime_error, "Unsupported Tensor shape for Add operation: {}", outDims); AIDGE_THROW_OR_ABORT(std::runtime_error, "Incompatible Tensor shape for Add Operation: {} for previous inputs vs {} for input#{}",
outDims, getInput(i)->dims(), i);
} }
} }
} }
......
...@@ -44,7 +44,8 @@ bool Aidge::Div_Op::forwardDims(bool /*allowDataDependency*/) { ...@@ -44,7 +44,8 @@ bool Aidge::Div_Op::forwardDims(bool /*allowDataDependency*/) {
outDims[out_id] = lowDims[low_id]; outDims[out_id] = lowDims[low_id];
} }
else if ((lowDims[low_id] != 1) && (lowDims[low_id] != outDims[out_id])) { else if ((lowDims[low_id] != 1) && (lowDims[low_id] != outDims[out_id])) {
AIDGE_THROW_OR_ABORT(std::runtime_error, "Unsupported Tensor shape for Div Operation: {}", outDims); AIDGE_THROW_OR_ABORT(std::runtime_error, "Incompatible Tensor shape for Div Operation: {} for input#0 vs {} for input#1",
inputsDims0, inputsDims1);
} }
--out_id; --out_id;
--low_id; --low_id;
......
...@@ -45,7 +45,8 @@ bool Aidge::Mul_Op::forwardDims(bool /*allowDataDependency*/) { ...@@ -45,7 +45,8 @@ bool Aidge::Mul_Op::forwardDims(bool /*allowDataDependency*/) {
outDims[out_id] = lowDims[low_id]; outDims[out_id] = lowDims[low_id];
} }
else if ((lowDims[low_id] != 1) && (lowDims[low_id] != outDims[out_id])) { else if ((lowDims[low_id] != 1) && (lowDims[low_id] != outDims[out_id])) {
AIDGE_THROW_OR_ABORT(std::runtime_error, "Unsupported Tensor shape for Mul Operation: {}", outDims); AIDGE_THROW_OR_ABORT(std::runtime_error, "Incompatible Tensor shape for Mul Operation: {} for input#0 vs {} for input#1",
inputsDims0, inputsDims1);
} }
--out_id; --out_id;
--low_id; --low_id;
...@@ -53,9 +54,6 @@ bool Aidge::Mul_Op::forwardDims(bool /*allowDataDependency*/) { ...@@ -53,9 +54,6 @@ bool Aidge::Mul_Op::forwardDims(bool /*allowDataDependency*/) {
mOutputs[0]->resize(outDims); mOutputs[0]->resize(outDims);
return true; return true;
} }
else if (!getInput(0)->empty() && !getInput(1)->empty()) {
AIDGE_THROW_OR_ABORT(std::runtime_error, "Incompatible input dimensions for Operator Mul: {} and {}", getInput(0)->dims(), getInput(1)->dims());
}
return false; return false;
} }
......
...@@ -44,7 +44,8 @@ bool Aidge::Pow_Op::forwardDims(bool /*allowDataDependency*/) { ...@@ -44,7 +44,8 @@ bool Aidge::Pow_Op::forwardDims(bool /*allowDataDependency*/) {
outDims[out_id] = lowDims[low_id]; outDims[out_id] = lowDims[low_id];
} }
else if ((lowDims[low_id] != 1) && (lowDims[low_id] != outDims[out_id])) { else if ((lowDims[low_id] != 1) && (lowDims[low_id] != outDims[out_id])) {
AIDGE_THROW_OR_ABORT(std::runtime_error, "Unsupported Tensor shape for Pow Operation: {}", outDims); AIDGE_THROW_OR_ABORT(std::runtime_error, "Incompatible Tensor shape for Pow Operation: {} for input#0 vs {} for input#1",
inputsDims0, inputsDims1);
} }
--out_id; --out_id;
--low_id; --low_id;
......
...@@ -46,7 +46,8 @@ bool Aidge::Sub_Op::forwardDims(bool /*allowDataDependency*/) { ...@@ -46,7 +46,8 @@ bool Aidge::Sub_Op::forwardDims(bool /*allowDataDependency*/) {
outDims[out_id] = lowDims[low_id]; outDims[out_id] = lowDims[low_id];
} }
else if ((lowDims[low_id] != 1) && (lowDims[low_id] != outDims[out_id])) { else if ((lowDims[low_id] != 1) && (lowDims[low_id] != outDims[out_id])) {
AIDGE_THROW_OR_ABORT(std::runtime_error, "Unsupported Tensor shape for Sub Operation: {}", outDims); AIDGE_THROW_OR_ABORT(std::runtime_error, "Incompatible Tensor shape for Sub Operation: {} for input#0 vs {} for input#1",
inputsDims0, inputsDims1);
} }
--out_id; --out_id;
--low_id; --low_id;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment