FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
arrayfire-binary-python-wrapper/tests/test_lower.py at master · arrayfire/arrayfire-binary-python-wrapper · GitHub
arrayfire
arrayfire-binary-python-wrapper
Repository navigation
Code
Issues
1
(1)
Pull requests
2
(2)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
arrayfire-binary-python-wrapper
/
tests
/
test_lower.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (36 loc) · 1.17 KB
Breadcrumbs
arrayfire-binary-python-wrapper
/
tests
/
test_lower.py
Copy path
File metadata and controls
45 lines (36 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import
pytest
import
arrayfire_wrapper
.
dtypes
as
dtypes
import
arrayfire_wrapper
.
lib
as
wrapper
@
pytest
.
mark
.
parametrize
(
"shape"
,
[
(
3
,
3
),
(
3
,
3
,
3
),
(
3
,
3
,
3
,
3
),
],
)
def
test_diag_is_unit
(
shape
:
tuple
)
->
None
:
"""Test if when is_unit_diag in lower returns an array with a unit diagonal"""
dtype
=
dtypes
.
s64
constant_array
=
wrapper
.
constant
(
3
,
shape
,
dtype
)
lower_array
=
wrapper
.
lower
(
constant_array
,
True
)
diagonal
=
wrapper
.
diag_extract
(
lower_array
,
0
)
diagonal_value
=
wrapper
.
get_scalar
(
diagonal
,
dtype
)
assert
diagonal_value
==
1
@
pytest
.
mark
.
parametrize
(
"shape"
,
[
(
3
,
3
),
(
3
,
3
,
3
),
(
3
,
3
,
3
,
3
),
],
)
def
test_is_original
(
shape
:
tuple
)
->
None
:
"""Test if is_original keeps the diagonal the same as the original array"""
dtype
=
dtypes
.
s64
constant_array
=
wrapper
.
constant
(
3
,
shape
,
dtype
)
original_value
=
wrapper
.
get_scalar
(
constant_array
,
dtype
)
lower_array
=
wrapper
.
lower
(
constant_array
,
False
)
diagonal
=
wrapper
.
diag_extract
(
lower_array
,
0
)
diagonal_value
=
wrapper
.
get_scalar
(
diagonal
,
dtype
)
assert
original_value
==
diagonal_value
Back
|
FazBrowse Home
|
New Git URL