Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
OpenFold
Commits
e9e3fbdc
Commit
e9e3fbdc
authored
Jun 12, 2022
by
Gustaf Ahdritz
Browse files
Fix unit test
parent
7d442323
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
tests/test_triangular_multiplicative_update.py
tests/test_triangular_multiplicative_update.py
+8
-8
No files found.
tests/test_triangular_multiplicative_update.py
View file @
e9e3fbdc
...
...
@@ -92,7 +92,7 @@ class TestTriangularMultiplicativeUpdate(unittest.TestCase):
out_repro
=
module
(
torch
.
as_tensor
(
pair_act
,
dtype
=
torch
.
float32
).
cuda
(),
mask
=
torch
.
as_tensor
(
pair_mask
,
dtype
=
torch
.
float32
).
cuda
(),
_in
ference_mod
e
=
True
,
_inplace_chunk_size
=
4
,
_in
plac
e
=
True
,
_inplace_chunk_size
=
4
,
).
cpu
()
self
.
assertTrue
(
torch
.
mean
(
torch
.
abs
(
out_gt
-
out_repro
))
<
consts
.
eps
)
...
...
@@ -105,7 +105,7 @@ class TestTriangularMultiplicativeUpdate(unittest.TestCase):
def
test_tri_mul_in_compare
(
self
):
self
.
_tri_mul_compare
(
incoming
=
True
)
def
_tri_mul_in
ference_mod
e
(
self
,
incoming
=
False
):
def
_tri_mul_in
plac
e
(
self
,
incoming
=
False
):
n_res
=
consts
.
n_res
pair_act
=
np
.
random
.
rand
(
n_res
,
n_res
,
consts
.
c_z
).
astype
(
np
.
float32
)
...
...
@@ -122,23 +122,23 @@ class TestTriangularMultiplicativeUpdate(unittest.TestCase):
out_stock
=
module
(
torch
.
as_tensor
(
pair_act
,
dtype
=
torch
.
float32
).
cuda
(),
mask
=
torch
.
as_tensor
(
pair_mask
,
dtype
=
torch
.
float32
).
cuda
(),
_in
ference_mod
e
=
False
,
_in
plac
e
=
False
,
).
cpu
()
# This has to come second because inference mode is in-place
out_in
ference_mod
e
=
module
(
out_in
plac
e
=
module
(
torch
.
as_tensor
(
pair_act
,
dtype
=
torch
.
float32
).
cuda
(),
mask
=
torch
.
as_tensor
(
pair_mask
,
dtype
=
torch
.
float32
).
cuda
(),
_in
ference_mod
e
=
True
,
_inplace_chunk_size
=
2
,
_in
plac
e
=
True
,
_inplace_chunk_size
=
2
,
).
cpu
()
self
.
assertTrue
(
torch
.
mean
(
torch
.
abs
(
out_stock
-
out_in
ference_mod
e
))
<
consts
.
eps
)
self
.
assertTrue
(
torch
.
mean
(
torch
.
abs
(
out_stock
-
out_in
plac
e
))
<
consts
.
eps
)
def
test_tri_mul_out_inference
(
self
):
self
.
_tri_mul_in
ference_mod
e
()
self
.
_tri_mul_in
plac
e
()
def
test_tri_mul_in_inference
(
self
):
self
.
_tri_mul_in
ference_mod
e
(
incoming
=
True
)
self
.
_tri_mul_in
plac
e
(
incoming
=
True
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment