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
8e507563
Commit
8e507563
authored
6 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add a unit test for pyfaust.Faust.concatenate().
parent
67c6974a
Branches
Branches containing commit
No related tags found
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
+31
-0
31 additions, 0 deletions
misc/test/src/Python/test_FaustPy.py
with
31 additions
and
0 deletions
misc/test/src/Python/test_FaustPy.py
+
31
−
0
View file @
8e507563
...
@@ -278,6 +278,37 @@ class TestFaustPy(unittest.TestCase):
...
@@ -278,6 +278,37 @@ class TestFaustPy(unittest.TestCase):
#TODO: test mul by a complex scalar when impl.
#TODO: test mul by a complex scalar when impl.
def
testConcatenate
(
self
):
from
pyfaust
import
FaustFactory
F
=
self
.
F
#if(F.dtype == np.complex): return
for
cat_axis
in
[
0
,
1
]:
G
=
\
FaustFactory
.
rand
(
self
.
r
.
randint
(
1
,
TestFaustPy
.
MAX_NUM_FACTORS
),
F
.
shape
[(
cat_axis
+
1
)
%
2
],
is_real
=
not
isinstance
(
self
,
TestFaustPyCplx
))
# add one random factor to get a random number of rows to test
# vertcat and a random number of cols to test horzcat
if
cat_axis
==
0
:
M
=
sparse
.
csr_matrix
(
np
.
random
.
rand
(
self
.
r
.
randint
(
1
,
TestFaustPy
.
MAX_DIM_SIZE
),
F
.
shape
[(
cat_axis
+
1
)
%
2
]).
astype
(
F
.
dtype
))
H
=
Faust
([
M
]
+
[
G
.
get_factor
(
i
)
for
i
in
range
(
0
,
G
.
get_num_factors
())])
else
:
M
=
sparse
.
csr_matrix
(
np
.
random
.
rand
(
F
.
shape
[(
cat_axis
+
1
)
%
2
],
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
])
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
),
10
**-
5
)
def
testTranspose
(
self
):
def
testTranspose
(
self
):
print
(
"
testTranspose()
"
)
print
(
"
testTranspose()
"
)
tFaust
=
self
.
F
.
transpose
()
tFaust
=
self
.
F
.
transpose
()
...
...
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