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
bc5cac44
Unverified
Commit
bc5cac44
authored
Sep 19, 2021
by
jwyyy
Committed by
GitHub
Sep 19, 2021
Browse files
fix broadcast tensor dim (#3351)
Co-authored-by:
Minjie Wang
<
wmjlyjemaine@gmail.com
>
parent
bacc9047
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
python/dgl/readout.py
python/dgl/readout.py
+4
-0
No files found.
python/dgl/readout.py
View file @
bc5cac44
...
@@ -413,6 +413,8 @@ def broadcast_nodes(graph, graph_feat, *, ntype=None):
...
@@ -413,6 +413,8 @@ def broadcast_nodes(graph, graph_feat, *, ntype=None):
--------
--------
broadcast_edges
broadcast_edges
"""
"""
if
len
(
F
.
shape
(
graph_feat
))
==
1
:
graph_feat
=
F
.
unsqueeze
(
graph_feat
,
dim
=
0
)
return
F
.
repeat
(
graph_feat
,
graph
.
batch_num_nodes
(
ntype
),
dim
=
0
)
return
F
.
repeat
(
graph_feat
,
graph
.
batch_num_nodes
(
ntype
),
dim
=
0
)
def
broadcast_edges
(
graph
,
graph_feat
,
*
,
etype
=
None
):
def
broadcast_edges
(
graph
,
graph_feat
,
*
,
etype
=
None
):
...
@@ -478,6 +480,8 @@ def broadcast_edges(graph, graph_feat, *, etype=None):
...
@@ -478,6 +480,8 @@ def broadcast_edges(graph, graph_feat, *, etype=None):
--------
--------
broadcast_nodes
broadcast_nodes
"""
"""
if
len
(
F
.
shape
(
graph_feat
))
==
1
:
graph_feat
=
F
.
unsqueeze
(
graph_feat
,
dim
=
0
)
return
F
.
repeat
(
graph_feat
,
graph
.
batch_num_edges
(
etype
),
dim
=
0
)
return
F
.
repeat
(
graph_feat
,
graph
.
batch_num_edges
(
etype
),
dim
=
0
)
READOUT_ON_ATTRS
=
{
READOUT_ON_ATTRS
=
{
...
...
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