Skip to content
Snippets Groups Projects
Commit b7d782f6 authored by Maxence Naud's avatar Maxence Naud
Browse files

Merge branch 'bugfix-6-divimpl-forward' into 'dev'

[Fix] Seg fault in Div forward file

See merge request !41
parents 6d4b1b3f 4a442396
No related branches found
No related tags found
2 merge requests!50version 0.2.0,!41[Fix] Seg fault in Div forward file
Pipeline #40499 passed
...@@ -91,16 +91,10 @@ void Aidge::DivImpl_cpu::forward() { ...@@ -91,16 +91,10 @@ void Aidge::DivImpl_cpu::forward() {
std::size_t contiguousIdx = nbDims - 1; std::size_t contiguousIdx = nbDims - 1;
for (; contiguousIdx+1 > 0; --contiguousIdx) { for (; contiguousIdx+1 > 0; --contiguousIdx) {
if (dims0[contiguousIdx] != dims1[contiguousIdx]) { if (dims0[contiguousIdx] != dims1[contiguousIdx]) {
if (contiguousIdx == (nbDims -1)) { if (contiguousIdx == (nbDims -1)) { // last dimensions of one of the input Tensor are of size 1
if (dims0[contiguousIdx] == 1) { const std::vector<std::size_t>& dims = (dims0[contiguousIdx] == 1) ? dims0 : dims1;
while ((dims0[contiguousIdx] == 1) && (contiguousIdx+1 > 0)) { while ((contiguousIdx+1 > 0) && (dims[contiguousIdx] == 1)) {
--contiguousIdx; --contiguousIdx;
}
}
else {
while ((dims1[contiguousIdx] == 1) && (contiguousIdx+1 > 0)) {
--contiguousIdx;
}
} }
} }
break; break;
......
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