Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
faust group
faust
Commits
c4bbdb8a
Commit
c4bbdb8a
authored
6 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
(Unit)test faustpy.Faust.concatenate() for more configs.
parent
23469329
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc/test/src/Python/test_FaustPy.py
+16
-13
16 additions, 13 deletions
misc/test/src/Python/test_FaustPy.py
with
16 additions
and
13 deletions
misc/test/src/Python/test_FaustPy.py
+
16
−
13
View file @
c4bbdb8a
...
...
@@ -279,7 +279,9 @@ class TestFaustPy(unittest.TestCase):
#TODO: test mul by a complex scalar when impl.
def
testConcatenate
(
self
):
print
(
"
testConcatenate()
"
)
from
pyfaust
import
FaustFactory
from
numpy.linalg
import
norm
F
=
self
.
F
FAUST
,
SPARSE
,
FULL
=
0
,
1
,
2
for
typeH
in
range
(
0
,
3
):
...
...
@@ -306,19 +308,20 @@ class TestFaustPy(unittest.TestCase):
self
.
r
.
randint
(
1
,
TestFaustPy
.
MAX_DIM_SIZE
)).
astype
(
F
.
dtype
))
H
=
Faust
([
G
.
get_factor
(
i
)
for
i
in
range
(
0
,
G
.
get_num_factors
())]
+
[
M
])
if
(
typeH
==
FAUST
):
H_
=
H
elif
(
typeH
==
SPARSE
):
from
scipy.sparse
import
csr_matrix
H_
=
csr_matrix
(
H
.
toarray
())
else
:
# typeH == FULL
H_
=
H
.
toarray
()
print
(
"
testConcatenate() F.shape, H.shape
"
,
F
.
shape
,
H
.
shape
)
C
=
F
.
concatenate
(
H_
,
axis
=
cat_axis
)
ref_C
=
np
.
concatenate
((
F
.
toarray
(),
H
.
toarray
()),
axis
=
cat_axis
)
self
.
assertLessEqual
(
np
.
linalg
.
norm
(
C
.
toarray
()
-
ref_C
)
/
norm
(
ref_C
),
if
(
typeH
==
FAUST
):
H_
=
H
elif
(
typeH
==
SPARSE
):
from
scipy.sparse
import
csr_matrix
H_
=
csr_matrix
(
H
.
toarray
())
else
:
# typeH == FULL
H_
=
H
.
toarray
()
print
(
"
testConcatenate() F.shape, H.shape
"
,
F
.
shape
,
H
.
shape
)
C
=
F
.
concatenate
(
H_
,
axis
=
cat_axis
)
ref_C
=
np
.
concatenate
((
F
.
toarray
(),
H
.
toarray
()),
axis
=
cat_axis
)
self
.
assertEqual
(
C
.
shape
,
ref_C
.
shape
)
self
.
assertLessEqual
(
norm
(
C
.
toarray
()
-
ref_C
)
/
norm
(
ref_C
),
10
**-
5
)
def
testTranspose
(
self
):
...
...
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