Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_backend_cpu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Charles Villard
aidge_backend_cpu
Commits
f235bef9
Commit
f235bef9
authored
1 year ago
by
laurent soulier
Browse files
Options
Downloads
Patches
Plain Diff
[UT]
parent
07307505
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unit_tests/data/Test_TensorImpl.cpp
+30
-13
30 additions, 13 deletions
unit_tests/data/Test_TensorImpl.cpp
with
30 additions
and
13 deletions
unit_tests/data/Test_TensorImpl.cpp
+
30
−
13
View file @
f235bef9
...
...
@@ -97,21 +97,20 @@ TEST_CASE("Tensor creation")
REQUIRE
(
x
==
xCopy
);
REQUIRE_FALSE
(
x
==
xFloat
);
}
SECTION
(
"rainbow"
)
}
SECTION
(
"rainbow"
)
{
Tensor
Rainbow
;
Rainbow
.
resize
({
2
,
4
,
5
});
Rainbow
.
setDatatype
(
DataType
::
UInt16
);
Rainbow
.
setBackend
(
"cpu"
);
REQUIRE
(
MakeRainbow
<
std
::
uint16_t
>
(
Rainbow
));
bool
res
=
true
;
for
(
NbElts_t
i
=
0
;
i
!=
Rainbow
.
size
();
++
i
)
{
Tensor
Rainbow
;
Rainbow
.
resize
({
2
,
4
,
5
});
Rainbow
.
setDatatype
(
DataType
::
UInt16
);
Rainbow
.
setBackend
(
"cpu"
);
REQUIRE
(
MakeRainbow
<
std
::
uint16_t
>
(
Rainbow
));
bool
res
=
true
;
for
(
NbElts_t
i
=
0
;
i
!=
Rainbow
.
size
();
++
i
)
{
res
&=
(
Rainbow
.
get
<
std
::
uint16_t
>
(
i
)
==
i
);
}
REQUIRE
(
res
);
res
&=
(
Rainbow
.
get
<
std
::
uint16_t
>
(
i
)
==
i
);
}
REQUIRE
(
res
);
}
}
...
...
@@ -152,5 +151,23 @@ TEST_CASE("Tensor extract")
{
SECTION
(
"shallow extract"
)
{
// Tensor Rainbow;
// Rainbow.resize({2, 4, 5});
// Rainbow.setDatatype(DataType::UInt16);
// Rainbow.setBackend("cpu");
// Tensor view(Rainbow, {2, 2, 3}, {0, 1, 1});
// for (Coord_t a = 0; a < view.dims()[0]; ++a)
// {
// for (Coord_t b = 0; b < view.dims()[1]; ++b)
// {
// for (Coord_t c = 0; c < view.dims()[2]; ++c)
// {
// REQUIRE(
// view.get<std::uint16_t>({a, b + 1, c + 1})
// == Rainbow.get<std::uint16_t>({a, b + 1, c + 1}));
// }
// }
// }
}
}
\ No newline at end of file
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