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
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_backend_cpu
Merge requests
!38
move tensorImpl cpu to core
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
move tensorImpl cpu to core
QualityOfLife
into
dev
Overview
0
Commits
21
Pipelines
9
Changes
5
Merged
Cyril Moineau
requested to merge
QualityOfLife
into
dev
1 year ago
Overview
0
Commits
21
Pipelines
9
Changes
5
Expand
move tensorImpl cpu to core
2
0
Merge request reports
Compare
dev
version 7
91acf7bb
1 year ago
version 6
f44682d4
1 year ago
version 5
26f1b943
1 year ago
version 4
47d84ec6
1 year ago
version 3
1b9aa57c
1 year ago
version 2
7d3be5ba
1 year ago
version 1
7d3be5ba
1 year ago
dev (base)
and
latest version
latest version
e4bfebc1
21 commits,
1 year ago
version 7
91acf7bb
20 commits,
1 year ago
version 6
f44682d4
13 commits,
1 year ago
version 5
26f1b943
12 commits,
1 year ago
version 4
47d84ec6
7 commits,
1 year ago
version 3
1b9aa57c
3 commits,
1 year ago
version 2
7d3be5ba
2 commits,
1 year ago
version 1
7d3be5ba
16 commits,
1 year ago
5 files
+
4
−
423
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
aidge_backend_cpu/unit_tests/test_tensor.py deleted
100644 → 0
+
0
−
71
Options
import
unittest
import
aidge_core
import
aidge_backend_cpu
import
numpy
as
np
class
test_tensor
(
unittest
.
TestCase
):
"""
Test tensor binding
"""
def
setUp
(
self
):
pass
def
tearDown
(
self
):
pass
def
test_getavailable_backends
(
self
):
self
.
assertTrue
(
"
cpu
"
in
aidge_core
.
Tensor
.
get_available_backends
())
def
test_numpy_int_to_tensor
(
self
):
np_array
=
np
.
arange
(
9
).
reshape
(
1
,
1
,
3
,
3
).
astype
(
np
.
int32
)
# Numpy -> Tensor
t
=
aidge_core
.
Tensor
(
np_array
)
self
.
assertEqual
(
t
.
dtype
(),
aidge_core
.
DataType
.
Int32
)
for
i_t
,
i_n
in
zip
(
t
,
np_array
.
flatten
()):
self
.
assertTrue
(
i_t
==
i_n
)
for
i
,
j
in
zip
(
t
.
dims
(),
np_array
.
shape
):
self
.
assertEqual
(
i
,
j
)
def
test_tensor_int_to_numpy
(
self
):
np_array
=
np
.
arange
(
9
).
reshape
(
1
,
1
,
3
,
3
)
# Numpy -> Tensor
t
=
aidge_core
.
Tensor
(
np_array
)
# Tensor -> Numpy
nnarray
=
np
.
array
(
t
)
for
i_nn
,
i_n
in
zip
(
nnarray
.
flatten
(),
np_array
.
flatten
()):
self
.
assertTrue
(
i_nn
==
i_n
)
for
i
,
j
in
zip
(
t
.
dims
(),
nnarray
.
shape
):
self
.
assertEqual
(
i
,
j
)
def
test_numpy_int64_to_tensor
(
self
):
np_array
=
np
.
arange
(
9
).
reshape
(
1
,
1
,
3
,
3
).
astype
(
np
.
int64
)
# Numpy -> Tensor
t
=
aidge_core
.
Tensor
(
np_array
)
self
.
assertEqual
(
t
.
dtype
(),
aidge_core
.
DataType
.
Int64
)
for
i_t
,
i_n
in
zip
(
t
,
np_array
.
flatten
()):
self
.
assertTrue
(
i_t
==
i_n
)
for
i
,
j
in
zip
(
t
.
dims
(),
np_array
.
shape
):
self
.
assertEqual
(
i
,
j
)
def
test_numpy_float_to_tensor
(
self
):
t
=
aidge_core
.
Tensor
()
np_array
=
np
.
random
.
rand
(
1
,
1
,
3
,
3
).
astype
(
np
.
float32
)
# Numpy -> Tensor
t
=
aidge_core
.
Tensor
(
np_array
)
self
.
assertEqual
(
t
.
dtype
(),
aidge_core
.
DataType
.
Float32
)
for
i_t
,
i_n
in
zip
(
t
,
np_array
.
flatten
()):
self
.
assertTrue
(
i_t
==
i_n
)
# TODO : May need to change this to a difference
for
i
,
j
in
zip
(
t
.
dims
(),
np_array
.
shape
):
self
.
assertEqual
(
i
,
j
)
def
test_get_set
(
self
):
dims
=
[
2
,
2
,
2
]
np_array
=
np
.
arange
(
8
).
reshape
(
dims
).
astype
(
np
.
int32
)
# Numpy -> Tensor
t
=
aidge_core
.
Tensor
(
np_array
)
for
i
in
range
(
8
):
self
.
assertEqual
(
t
[
i
],
i
)
t
[
i
]
=
5
self
.
assertEqual
(
t
[
i
],
5
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
Loading