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
64493e08
"git@developer.sourcefind.cn:OpenDAS/dynamo.git" did not exist on "b0655a3465904ff265bdc1e1ccdcff009a448bb0"
Commit
64493e08
authored
Jul 14, 2023
by
Geoffrey Yu
Browse files
reduce asym_id in chain_center_of_mass_loss by 1 to avoid torch one_hot error
parent
2c4d4183
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
openfold/utils/loss.py
openfold/utils/loss.py
+1
-1
No files found.
openfold/utils/loss.py
View file @
64493e08
...
@@ -1667,7 +1667,7 @@ def chain_center_of_mass_loss(
...
@@ -1667,7 +1667,7 @@ def chain_center_of_mass_loss(
all_atom_positions
=
all_atom_positions
[...,
ca_pos
,
:]
all_atom_positions
=
all_atom_positions
[...,
ca_pos
,
:]
all_atom_mask
=
all_atom_mask
[...,
ca_pos
:
(
ca_pos
+
1
)]
# keep dim
all_atom_mask
=
all_atom_mask
[...,
ca_pos
:
(
ca_pos
+
1
)]
# keep dim
chains
,
_
=
asym_id
.
unique
(
return_counts
=
True
)
chains
,
_
=
asym_id
.
unique
(
return_counts
=
True
)
one_hot
=
torch
.
nn
.
functional
.
one_hot
(
asym_id
.
to
(
torch
.
int64
)
,
one_hot
=
torch
.
nn
.
functional
.
one_hot
(
asym_id
.
to
(
torch
.
int64
)
-
1
,
# have to reduce asym_id by one because class values must be smaller than num_classes
num_classes
=
chains
.
shape
[
0
]).
to
(
dtype
=
all_atom_mask
.
dtype
)
# make sure asym_id dtype is int
num_classes
=
chains
.
shape
[
0
]).
to
(
dtype
=
all_atom_mask
.
dtype
)
# make sure asym_id dtype is int
one_hot
=
one_hot
*
all_atom_mask
one_hot
=
one_hot
*
all_atom_mask
chain_pos_mask
=
one_hot
.
transpose
(
-
2
,
-
1
)
chain_pos_mask
=
one_hot
.
transpose
(
-
2
,
-
1
)
...
...
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