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
5b97a1a2
Unverified
Commit
5b97a1a2
authored
May 05, 2022
by
Krzysztof Sadowski
Committed by
GitHub
May 05, 2022
Browse files
add bias argument (#3970)
parent
ae7e3db6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
python/dgl/nn/pytorch/hetero.py
python/dgl/nn/pytorch/hetero.py
+4
-2
No files found.
python/dgl/nn/pytorch/hetero.py
View file @
5b97a1a2
...
@@ -260,6 +260,8 @@ class HeteroLinear(nn.Module):
...
@@ -260,6 +260,8 @@ class HeteroLinear(nn.Module):
Input feature size for heterogeneous inputs. A key can be a string or a tuple of strings.
Input feature size for heterogeneous inputs. A key can be a string or a tuple of strings.
out_size : int
out_size : int
Output feature size.
Output feature size.
bias : bool, optional
If True, learns a bias term. Defaults: ``True``.
Examples
Examples
--------
--------
...
@@ -276,12 +278,12 @@ class HeteroLinear(nn.Module):
...
@@ -276,12 +278,12 @@ class HeteroLinear(nn.Module):
>>> print(out_feats[('user', 'follows', 'user')].shape)
>>> print(out_feats[('user', 'follows', 'user')].shape)
torch.Size([3, 3])
torch.Size([3, 3])
"""
"""
def
__init__
(
self
,
in_size
,
out_size
):
def
__init__
(
self
,
in_size
,
out_size
,
bias
=
True
):
super
(
HeteroLinear
,
self
).
__init__
()
super
(
HeteroLinear
,
self
).
__init__
()
self
.
linears
=
nn
.
ModuleDict
()
self
.
linears
=
nn
.
ModuleDict
()
for
typ
,
typ_in_size
in
in_size
.
items
():
for
typ
,
typ_in_size
in
in_size
.
items
():
self
.
linears
[
str
(
typ
)]
=
nn
.
Linear
(
typ_in_size
,
out_size
)
self
.
linears
[
str
(
typ
)]
=
nn
.
Linear
(
typ_in_size
,
out_size
,
bias
=
bias
)
def
forward
(
self
,
feat
):
def
forward
(
self
,
feat
):
"""Forward function
"""Forward function
...
...
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