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
torchani
Commits
be58b3fe
"src/vscode:/vscode.git/clone" did not exist on "12fd0736dcc51f77c52130ab10177d0c1d5a29d9"
Commit
be58b3fe
authored
Nov 05, 2019
by
Gao, Xiang
Committed by
Farhad Ramezanghorbani
Nov 06, 2019
Browse files
Cleanup some junks inside ANIModel introduced due to JIT (#362)
parent
86500df0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
11 deletions
+2
-11
torchani/nn.py
torchani/nn.py
+2
-11
No files found.
torchani/nn.py
View file @
be58b3fe
...
...
@@ -16,19 +16,11 @@ class ANIModel(torch.nn.Module):
:attr:`modules`, which means, for example ``modules[i]`` must be
the module for atom type ``i``. Different atom types can share a
module by putting the same reference in :attr:`modules`.
padding_fill (float): The value to fill output of padding atoms.
Padding values will participate in reducing, so this value should
be appropriately chosen so that it has no effect on the result. For
example, if the reducer is :func:`torch.sum`, then
:attr:`padding_fill` should be 0, and if the reducer is
:func:`torch.min`, then :attr:`padding_fill` should be
:obj:`math.inf`.
"""
def
__init__
(
self
,
modules
,
padding_fill
=
0
):
def
__init__
(
self
,
modules
):
super
(
ANIModel
,
self
).
__init__
()
self
.
module_list
=
torch
.
nn
.
ModuleList
(
modules
)
self
.
padding_fill
=
padding_fill
def
__getitem__
(
self
,
i
):
return
self
.
module_list
[
i
]
...
...
@@ -39,8 +31,7 @@ class ANIModel(torch.nn.Module):
species_
=
species
.
flatten
()
aev
=
aev
.
flatten
(
0
,
1
)
output
=
torch
.
full
(
species_
.
shape
,
self
.
padding_fill
,
dtype
=
aev
.
dtype
,
device
=
species
.
device
)
output
=
aev
.
new_zeros
(
species_
.
shape
)
for
i
,
m
in
enumerate
(
self
.
module_list
):
mask
=
(
species_
==
i
)
...
...
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