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
2ae190d6
Unverified
Commit
2ae190d6
authored
Jun 02, 2021
by
Quan (Andy) Gan
Committed by
GitHub
Jun 02, 2021
Browse files
[Doc] fix shape mismatch problem in user guide (#2938)
Co-authored-by:
Minjie Wang
<
wmjlyjemaine@gmail.com
>
parent
527bbfa8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
docs/source/guide/training-link.rst
docs/source/guide/training-link.rst
+2
-2
No files found.
docs/source/guide/training-link.rst
View file @
2ae190d6
...
@@ -110,7 +110,7 @@ computes loss.
...
@@ -110,7 +110,7 @@ computes loss.
def
compute_loss
(
pos_score
,
neg_score
):
def
compute_loss
(
pos_score
,
neg_score
):
#
Margin
loss
#
Margin
loss
n_edges
=
pos_score
.
shape
[
0
]
n_edges
=
pos_score
.
shape
[
0
]
return
(
1
-
pos_score
.
unsqueeze
(
1
)
+
neg_score
.
view
(
n_edges
,
-
1
)).
clamp
(
min
=
0
).
mean
()
return
(
1
-
pos_score
+
neg_score
.
view
(
n_edges
,
-
1
)).
clamp
(
min
=
0
).
mean
()
node_features
=
graph
.
ndata
[
'feat'
]
node_features
=
graph
.
ndata
[
'feat'
]
n_features
=
node_features
.
shape
[
1
]
n_features
=
node_features
.
shape
[
1
]
...
@@ -195,7 +195,7 @@ The training loop is similar to that of homogeneous graphs.
...
@@ -195,7 +195,7 @@ The training loop is similar to that of homogeneous graphs.
def
compute_loss
(
pos_score
,
neg_score
):
def
compute_loss
(
pos_score
,
neg_score
):
#
Margin
loss
#
Margin
loss
n_edges
=
pos_score
.
shape
[
0
]
n_edges
=
pos_score
.
shape
[
0
]
return
(
1
-
pos_score
.
unsqueeze
(
1
)
+
neg_score
.
view
(
n_edges
,
-
1
)).
clamp
(
min
=
0
).
mean
()
return
(
1
-
pos_score
+
neg_score
.
view
(
n_edges
,
-
1
)).
clamp
(
min
=
0
).
mean
()
k
=
5
k
=
5
model
=
Model
(
10
,
20
,
5
,
hetero_graph
.
etypes
)
model
=
Model
(
10
,
20
,
5
,
hetero_graph
.
etypes
)
...
...
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