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
dgl
Commits
4eba1ce2
Unverified
Commit
4eba1ce2
authored
Oct 25, 2019
by
Mufei Li
Committed by
GitHub
Oct 25, 2019
Browse files
[Chemistry] Hot fix (#953)
* Hot fix * CI
parent
577cf2e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
python/dgl/data/chem/utils.py
python/dgl/data/chem/utils.py
+5
-3
No files found.
python/dgl/data/chem/utils.py
View file @
4eba1ce2
...
...
@@ -46,10 +46,12 @@ def one_hot_encoding(x, allowable_set, encode_unknown=False):
The list is of length ``len(allowable_set)`` if ``encode_unknown=False``
and ``len(allowable_set) + 1`` otherwise.
"""
if
encode_unknown
:
if
encode_unknown
and
(
allowable_set
[
-
1
]
is
not
None
)
:
allowable_set
.
append
(
None
)
if
x
not
in
allowable_set
:
if
encode_unknown
and
(
x
not
in
allowable_set
):
x
=
None
return
list
(
map
(
lambda
s
:
x
==
s
,
allowable_set
))
#################################################################
...
...
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