Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
aidge_core
Commits
b91f4448
Commit
b91f4448
authored
1 year ago
by
Maxence Naud
Browse files
Options
Downloads
Patches
Plain Diff
[Upd] Conv and ConvDepthWise tests
parent
1c8db798
No related branches found
No related tags found
1 merge request
!54
horizontal tiling
Pipeline
#34909
failed
1 year ago
Stage: static_analysis
Stage: build
Stage: test
Stage: coverage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
unit_tests/operator/Test_ConvDepthWise_Op.cpp
+41
-36
41 additions, 36 deletions
unit_tests/operator/Test_ConvDepthWise_Op.cpp
unit_tests/operator/Test_Conv_Op.cpp
+5
-3
5 additions, 3 deletions
unit_tests/operator/Test_Conv_Op.cpp
with
46 additions
and
39 deletions
unit_tests/operator/Test_ConvDepthWise_Op.cpp
+
41
−
36
View file @
b91f4448
...
...
@@ -22,47 +22,52 @@
#include
"aidge/utils/Types.h"
namespace
Aidge
{
//
TEST_CASE("[core/operator] ConvDepthWise_Op(computeReceptiveField)", "[Operator][computeReceptiveFiled][ConvDepthWise]") {
//
auto dataProvider = Producer({16, 3, 224, 224}, "dataProvider");
//
auto conv1 = ConvDepthWise({5, 5}, "conv1"); // output dims: {16, 3, 220, 220}
//
auto conv2 = ConvDepthWise({3, 3}, "conv2"); // output dims: {16, 3, 218, 218}
//
auto conv3 = ConvDepthWise({2, 2}, "conv3", {2,2}); // output dims: {16, 3, 109, 109}
//
auto conv4 = ConvDepthWise({1, 1}, "conv4"); // output dims: {16, 3, 109, 109}
TEST_CASE
(
"[core/operator] ConvDepthWise_Op(computeReceptiveField)"
,
"[Operator][computeReceptiveFiled][ConvDepthWise]"
)
{
auto
dataProvider
=
Producer
({
16
,
3
,
224
,
224
},
"dataProvider"
);
auto
conv1
=
ConvDepthWise
(
3
,
{
5
,
5
},
"conv1"
);
// output dims: {16, 3, 220, 220}
auto
conv2
=
ConvDepthWise
(
3
,
{
3
,
3
},
"conv2"
);
// output dims: {16, 3, 218, 218}
auto
conv3
=
ConvDepthWise
(
3
,
{
2
,
2
},
"conv3"
,
{
2
,
2
});
// output dims: {16, 3, 109, 109}
auto
conv4
=
ConvDepthWise
(
3
,
{
1
,
1
},
"conv4"
);
// output dims: {16, 3, 109, 109}
//
auto g = std::make_shared<GraphView>("TestGraph");
auto
g
=
std
::
make_shared
<
GraphView
>
(
"TestGraph"
);
//
dataProvider->addChild(conv1, 0);
//
g->add(conv1);
//
g->addChild(conv2, conv1, 0);
//
g->addChild(conv3, conv2, 0);
//
g->addChild(conv4, conv3, 0);
dataProvider
->
addChild
(
conv1
,
0
);
g
->
add
(
conv1
);
g
->
addChild
(
conv2
,
conv1
,
0
);
g
->
addChild
(
conv3
,
conv2
,
0
);
g
->
addChild
(
conv4
,
conv3
,
0
);
//
g->forwardDims();
g
->
forwardDims
();
// SECTION("Check individual receptive fields") {
// auto res1 = conv1->getOperator()->computeReceptiveField(0, {16,3,10,10});
// auto res2 = conv2->getOperator()->computeReceptiveField(conv2->getOperator()->output(0).getIdx({3,1,100,28}), {4,2,30,40});
// auto res3 = conv3->getOperator()->computeReceptiveField(0, {1,1,109,109});
// auto res4 = conv4->getOperator()->computeReceptiveField(conv4->getOperator()->input(0).getIdx({5,0,108,108}), {10,1,1,1});
auto
op1
=
std
::
dynamic_pointer_cast
<
OperatorTensor
>
(
conv1
->
getOperator
());
auto
op2
=
std
::
dynamic_pointer_cast
<
OperatorTensor
>
(
conv2
->
getOperator
());
auto
op3
=
std
::
dynamic_pointer_cast
<
OperatorTensor
>
(
conv3
->
getOperator
());
auto
op4
=
std
::
dynamic_pointer_cast
<
OperatorTensor
>
(
conv4
->
getOperator
());
// REQUIRE(((res1[0].first == 0) && (res1[0].second == std::vector<DimSize_t>({16, 3, 14, 14}))));
//
REQUIRE(((res2[0].first == conv2->getOperator()->input(0).getIdx({3,1,100,28})) && (res2[0].second == std::vector<DimSize_t>({4, 2, 32, 42})))
);
//
REQUIRE(((res3[0].first == 0) && (res3[0].second == std::vector<DimSize_t>({1, 1, 218, 218})))
);
//
REQUIRE(((res4[0].first == conv4->getOperator()->input(0).getIdx({5, 0, 108, 108})) && (res4[0].second == std::vector<DimSize_t>({1
0, 1,
1,
1})))
);
//
}
SECTION
(
"Check individual receptive fields"
)
{
auto
res1
=
op1
->
computeReceptiveField
(
0
,
{
16
,
3
,
10
,
10
}
);
auto
res2
=
op2
->
computeReceptiveField
(
op2
->
getOutput
(
0
)
->
getIdx
({
3
,
1
,
100
,
28
}),
{
4
,
2
,
30
,
40
}
);
auto
res3
=
op3
->
computeReceptiveField
(
0
,
{
1
,
1
,
109
,
109
}
);
auto
res4
=
op4
->
computeReceptiveField
(
op4
->
getInput
(
0
)
->
getIdx
({
5
,
0
,
108
,
108
}),
{
10
,
1
,
1
,
1
});
// SECTION("Check receptive field propagation") {
// // input: first-{5, 0, 50, 50} dims-{1, 1, 1, 1}
// auto res4 = conv4->getOperator()->computeReceptiveField(conv4->getOperator()->input(0).getIdx({5,0,50,50}), {1,1,1,1});
// // conv4 RF: first-{5, 0, 50, 50} dims-{1, 1, 1, 1}
// auto res3 = conv3->getOperator()->computeReceptiveField(res4[0].first, res4[0].second);
// // conv3 RF: first-{5, 0, 100, 100} dims-{1, 1, 2, 2}
// auto res2 = conv2->getOperator()->computeReceptiveField(res3[0].first, res3[0].second);
// // conv2 RF: first-{5, 0, 100, 100} dims-{1, 1, 4, 4}
// auto res1 = conv1->getOperator()->computeReceptiveField(res2[0].first, res2[0].second);
// // conv1 RF: first-{5, 0, 100, 100} dims-{1, 1, 8, 8}
REQUIRE
(((
res1
[
0
].
first
==
0
)
&&
(
res1
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
16
,
3
,
14
,
14
}))));
REQUIRE
(((
res2
[
0
].
first
==
op2
->
getInput
(
0
)
->
getIdx
({
3
,
1
,
100
,
28
}))
&&
(
res2
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
4
,
2
,
32
,
42
}))));
REQUIRE
(((
res3
[
0
].
first
==
0
)
&&
(
res3
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
1
,
1
,
218
,
218
}))));
REQUIRE
(((
res4
[
0
].
first
==
op4
->
getInput
(
0
)
->
getIdx
({
5
,
0
,
108
,
108
}))
&&
(
res4
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
10
,
1
,
1
,
1
}))));
}
// REQUIRE(((res1[0].first == conv1->getOperator()->input(0).getIdx({5, 0, 100, 100})) && (res1[0].second == std::vector<DimSize_t>({1, 1, 8, 8}))));
// }
// }
SECTION
(
"Check receptive field propagation"
)
{
// input: first-{5, 0, 50, 50} dims-{1, 1, 1, 1}
auto
res4
=
op4
->
computeReceptiveField
(
op4
->
getInput
(
0
)
->
getIdx
({
5
,
0
,
50
,
50
}),
{
1
,
1
,
1
,
1
});
// conv4 RF: first-{5, 0, 50, 50} dims-{1, 1, 1, 1}
auto
res3
=
op3
->
computeReceptiveField
(
res4
[
0
].
first
,
res4
[
0
].
second
);
// conv3 RF: first-{5, 0, 100, 100} dims-{1, 1, 2, 2}
auto
res2
=
op2
->
computeReceptiveField
(
res3
[
0
].
first
,
res3
[
0
].
second
);
// conv2 RF: first-{5, 0, 100, 100} dims-{1, 1, 4, 4}
auto
res1
=
op1
->
computeReceptiveField
(
res2
[
0
].
first
,
res2
[
0
].
second
);
// conv1 RF: first-{5, 0, 100, 100} dims-{1, 1, 8, 8}
REQUIRE
(((
res1
[
0
].
first
==
op1
->
getInput
(
0
)
->
getIdx
({
5
,
0
,
100
,
100
}))
&&
(
res1
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
1
,
1
,
8
,
8
}))));
}
}
}
// namespace Aidge
\ No newline at end of file
This diff is collapsed.
Click to expand it.
unit_tests/operator/Test_Conv_Op.cpp
+
5
−
3
View file @
b91f4448
...
...
@@ -51,9 +51,11 @@ TEST_CASE("[core/operator] Conv_Op(computeReceptiveField)", "[Operator][computeR
auto
res4
=
op4
->
computeReceptiveField
(
op4
->
getOutput
(
0
)
->
getIdx
({
5
,
0
,
108
,
108
}),
{
10
,
10
,
1
,
1
});
REQUIRE
(((
res1
[
0
].
first
==
0
)
&&
(
res1
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
16
,
3
,
14
,
14
}))));
REQUIRE
(((
res2
[
0
].
first
==
op2
->
input
(
0
).
getIdx
({
3
,
0
,
100
,
28
}))
&&
(
res2
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
4
,
32
,
32
,
42
}))));
REQUIRE
(((
res1
[
1
].
first
==
0
)
&&
(
res1
[
1
].
second
==
std
::
vector
<
DimSize_t
>
({
32
,
3
,
5
,
5
}))));
REQUIRE
(((
res1
[
2
].
first
==
0
)
&&
(
res1
[
2
].
second
==
std
::
vector
<
DimSize_t
>
({
32
}))));
REQUIRE
(((
res2
[
0
].
first
==
op2
->
getInput
(
0
)
->
getIdx
({
3
,
0
,
100
,
28
}))
&&
(
res2
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
4
,
32
,
32
,
42
}))));
REQUIRE
(((
res3
[
0
].
first
==
0
)
&&
(
res3
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
1
,
64
,
218
,
218
}))));
REQUIRE
(((
res4
[
0
].
first
==
op4
->
i
nput
(
0
)
.
getIdx
({
5
,
0
,
108
,
108
}))
&&
(
res4
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
10
,
10
,
1
,
1
}))));
REQUIRE
(((
res4
[
0
].
first
==
op4
->
getI
nput
(
0
)
->
getIdx
({
5
,
0
,
108
,
108
}))
&&
(
res4
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
10
,
10
,
1
,
1
}))));
}
SECTION
(
"Check receptive field propagation"
)
{
...
...
@@ -67,7 +69,7 @@ TEST_CASE("[core/operator] Conv_Op(computeReceptiveField)", "[Operator][computeR
auto
res1
=
op1
->
computeReceptiveField
(
res2
[
0
].
first
,
res2
[
0
].
second
);
// conv1 RF: first-{5, 0, 100, 100} dims-{1, 3, 8, 8}
REQUIRE
(((
res1
[
0
].
first
==
op1
->
i
nput
(
0
)
.
getIdx
({
5
,
0
,
100
,
100
}))
&&
(
res1
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
1
,
3
,
8
,
8
}))));
REQUIRE
(((
res1
[
0
].
first
==
op1
->
getI
nput
(
0
)
->
getIdx
({
5
,
0
,
100
,
100
}))
&&
(
res1
[
0
].
second
==
std
::
vector
<
DimSize_t
>
({
1
,
3
,
8
,
8
}))));
// std::cout << "conv1: {";
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment