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
251a9842
Unverified
Commit
251a9842
authored
Oct 02, 2019
by
Da Zheng
Committed by
GitHub
Oct 02, 2019
Browse files
fix (#898)
parent
190cdbd2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
src/graph/sampler.cc
src/graph/sampler.cc
+4
-0
No files found.
src/graph/sampler.cc
View file @
251a9842
...
...
@@ -993,6 +993,8 @@ NegSubgraph NegEdgeSubgraph(GraphPtr gptr, IdArray relations, const Subgraph &po
int
neg_sample_size
,
bool
exclude_positive
,
bool
check_false_neg
)
{
int64_t
num_tot_nodes
=
gptr
->
NumVertices
();
if
(
neg_sample_size
>
num_tot_nodes
)
neg_sample_size
=
num_tot_nodes
;
bool
is_multigraph
=
gptr
->
IsMultigraph
();
std
::
vector
<
IdArray
>
adj
=
pos_subg
.
graph
->
GetAdj
(
false
,
"coo"
);
IdArray
coo
=
adj
[
0
];
...
...
@@ -1165,6 +1167,8 @@ NegSubgraph PBGNegEdgeSubgraph(GraphPtr gptr, IdArray relations, const Subgraph
std
::
vector
<
IdArray
>
adj
=
pos_subg
.
graph
->
GetAdj
(
false
,
"coo"
);
IdArray
coo
=
adj
[
0
];
int64_t
num_pos_edges
=
coo
->
shape
[
0
]
/
2
;
if
(
neg_sample_size
>
num_tot_nodes
)
neg_sample_size
=
num_tot_nodes
;
int64_t
chunk_size
=
neg_sample_size
;
// If num_pos_edges isn't divisible by chunk_size, the actual number of chunks
...
...
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