"...python/git@developer.sourcefind.cn:change/sglang.git" did not exist on "6f509d550350d98999a7e9f2a16e78dcd478be6b"
Unverified Commit 6f28e1ad authored by Songqing Zhang's avatar Songqing Zhang Committed by GitHub
Browse files

[misc] Fix build warnings (#6037)


Co-authored-by: default avatarHongzhi (Steve), Chen <chenhongzhi.nkcs@gmail.com>
parent 6af55f18
...@@ -1017,7 +1017,7 @@ class HeteroGraphIndex(ObjectBase): ...@@ -1017,7 +1017,7 @@ class HeteroGraphIndex(ObjectBase):
raise DGLError("Invalid incidence matrix type: %s" % str(typestr)) raise DGLError("Invalid incidence matrix type: %s" % str(typestr))
return inc, shuffle_idx return inc, shuffle_idx
def node_subgraph(self, induced_nodes, relabel_nodes): def node_subgraph(self, induced_nodes):
"""Return the induced node subgraph. """Return the induced node subgraph.
Parameters Parameters
...@@ -1025,9 +1025,6 @@ class HeteroGraphIndex(ObjectBase): ...@@ -1025,9 +1025,6 @@ class HeteroGraphIndex(ObjectBase):
induced_nodes : list of utils.Index induced_nodes : list of utils.Index
Induced nodes. The length should be equal to the number of Induced nodes. The length should be equal to the number of
node types in this heterograph. node types in this heterograph.
relabel_nodes : bool
If True, the extracted subgraph will only have the nodes in the specified node set
and it will relabel the nodes in order.
Returns Returns
------- -------
...@@ -1035,7 +1032,7 @@ class HeteroGraphIndex(ObjectBase): ...@@ -1035,7 +1032,7 @@ class HeteroGraphIndex(ObjectBase):
The subgraph index. The subgraph index.
""" """
vids = [F.to_dgl_nd(nodes) for nodes in induced_nodes] vids = [F.to_dgl_nd(nodes) for nodes in induced_nodes]
return _CAPI_DGLHeteroVertexSubgraph(self, vids, relabel_nodes) return _CAPI_DGLHeteroVertexSubgraph(self, vids)
def edge_subgraph(self, induced_edges, preserve_nodes): def edge_subgraph(self, induced_edges, preserve_nodes):
"""Return the induced edge subgraph. """Return the induced edge subgraph.
......
...@@ -161,7 +161,7 @@ def node_subgraph( ...@@ -161,7 +161,7 @@ def node_subgraph(
nodes.get(ntype, F.copy_to(F.tensor([], graph.idtype), device)) nodes.get(ntype, F.copy_to(F.tensor([], graph.idtype), device))
for ntype in graph.ntypes for ntype in graph.ntypes
] ]
sgi = graph._graph.node_subgraph(induced_nodes, relabel_nodes) sgi = graph._graph.node_subgraph(induced_nodes)
induced_edges = sgi.induced_edges induced_edges = sgi.induced_edges
if not relabel_nodes: if not relabel_nodes:
sgi = graph._graph.edge_subgraph(induced_edges, True) sgi = graph._graph.edge_subgraph(induced_edges, True)
......
...@@ -383,9 +383,9 @@ List<Value> Libra2dglBuildDict( ...@@ -383,9 +383,9 @@ List<Value> Libra2dglBuildDict(
while (!feof(fp) && edge < fsize) { while (!feof(fp) && edge < fsize) {
int64_t u, v; int64_t u, v;
float w; float w;
fscanf( CHECK_EQ(
fp, "%ld,%ld,%f\n", &u, &v, fscanf(fp, "%ld,%ld,%f\n", &u, &v, &w),
&w); // reading an edge - the src and dst global node IDs 3); // reading an edge - the src and dst global node IDs
if (indices_ptr[u] == if (indices_ptr[u] ==
-100) { // if already not assigned a local node ID, local node ID is -100) { // if already not assigned a local node ID, local node ID is
......
...@@ -403,7 +403,6 @@ DGL_REGISTER_GLOBAL("heterograph_index._CAPI_DGLHeteroVertexSubgraph") ...@@ -403,7 +403,6 @@ DGL_REGISTER_GLOBAL("heterograph_index._CAPI_DGLHeteroVertexSubgraph")
.set_body([](DGLArgs args, DGLRetValue* rv) { .set_body([](DGLArgs args, DGLRetValue* rv) {
HeteroGraphRef hg = args[0]; HeteroGraphRef hg = args[0];
List<Value> vids = args[1]; List<Value> vids = args[1];
bool relabel_nodes = args[2];
std::vector<IdArray> vid_vec; std::vector<IdArray> vid_vec;
vid_vec.reserve(vids.size()); vid_vec.reserve(vids.size());
for (Value val : vids) { for (Value val : vids) {
......
...@@ -1169,11 +1169,15 @@ NegSubgraph EdgeSamplerObject::genNegEdgeSubgraph( ...@@ -1169,11 +1169,15 @@ NegSubgraph EdgeSamplerObject::genNegEdgeSubgraph(
} }
prev_neg_offset = neg_vids.size(); prev_neg_offset = neg_vids.size();
randomSample(num_tot_nodes, neg_sample_size, exclude, &neg_vids); randomSample(num_tot_nodes, neg_sample_size, exclude, &neg_vids);
assert(prev_neg_offset + neg_sample_size == neg_vids.size()); assert(
static_cast<size_t>(prev_neg_offset + neg_sample_size) ==
neg_vids.size());
} else if (neg_sample_size < num_tot_nodes) { } else if (neg_sample_size < num_tot_nodes) {
prev_neg_offset = neg_vids.size(); prev_neg_offset = neg_vids.size();
randomSample(num_tot_nodes, neg_sample_size, &neg_vids); randomSample(num_tot_nodes, neg_sample_size, &neg_vids);
assert(prev_neg_offset + neg_sample_size == neg_vids.size()); assert(
static_cast<size_t>(prev_neg_offset + neg_sample_size) ==
neg_vids.size());
} else if (exclude_positive) { } else if (exclude_positive) {
LOG(FATAL) << "We can't exclude positive edges" LOG(FATAL) << "We can't exclude positive edges"
"when sampling negative edges with all nodes."; "when sampling negative edges with all nodes.";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment