feat : support for conv3D forward
Context
issue : #38 (closed), aidge#252 (closed)
Added :
- Conv3D
- ConvTranspose3D
- Pad3D
- PaddedConv3D
- PaddedConvTranspose3D
Enhancements
Conv1D
& Conv2D
backward functions have been optimized : indexing is now done by only incrementing the index counters without using multiplication.
Before
for (DimSize_t kX = 0; kX < kDim[0]; ++kX) {
kOffsets[2] = kX * kStrides[2] + kOffsets[1];
iDilKernelOffsets[0] = kX * dilation[0] * iStrides[2];
// DOING STUFF ...........
}
After
iDilKernelOffsets[0] = 0;
kOffsets[2] = kOffsets[1];
for (DimSize_t kX = 0; kX < kDims[0]; ++kX,
kOffsets[2] += kStrides[2],
iDilKernelOffsets[0] += dilation[0] *
iStrides[2]) {
// DOING STUFF ...........
}
NOTE : This implies a bit of unconventionnal over-crowding the for loops. That is usually written as :
for (DimSize_t kX = 0; kX < kDims[0]; ++kX) {
// DOING STUFF ...........
kOffsets[2] += kStrides[2];
iDilKernelOffsets[0] += dilation[0] * iStrides[2];
}
but since the the //DOING STUFF.......
usually contains 3+ nested loops, this would quickly be un-readable. Hence I chose to use the 1st "overcrowded for loop" syntax.
Merge request reports
Activity
added Missing 💨 TopicOperator labels
assigned to @gregkub
requested review from @hrouis
requested review from @pineapple
Ok so before I modify all functions :
- here is the original code I wrote
- Here is the same function modified accordingly to your requirements in the latest commit.
Could you confirm this is what you want ? I'll do the modifications after that.
thanks
- Resolved by Grégoire Kubler
IMO, this kind of loop indexing optimizations are not worth it, for several reasons:
- It makes the code much less readable, as it become much harder to understand the indexing mechanism;
- It will need to be rewritten anyway if one decides to parallelize the loop (for example with OpenMP);
- I think it will change absolutely nothing in terms of performances: it is most certainly already optimized by the compiler.
added 1 commit
For example such a regular array: https://gitlab.eclipse.org/eclipse/aidge/aidge_backend_cpu/-/blame/8b09d81fca5dcc21abdda2d45cbb76c26184d395/unit_tests/operator/Test_ConvImpl.cpp?page=6#L5972 should be done using std::iota instead of writting 4000 + lines ...
We talked with @pineapple and I think this unit test really higlight the limitation of the current way we have of testing Operators.
I would be in favor of dropping this file (and the commit associated in the hisotry) since it will add almost 1MB to the code base. And to move to test using benchmark tools to compare with ONNRT implementations.
What I propose is to merge this without unit test and add an issue for creating unit test using benchmark tools and mark the untested operator of this MR to be added in these tests.
@cmoineau I cleaned up the tests to reduce the file size 10k lines, I also cleaned up previous 1/2D backward tests for conv in this commit : !160 (f4235226)
I am not authorized to but push on dev but this commit could be fused with c0dbb037 for cleaner history
added 2 commits
added 3 commits
added 2 commits