Skip to content

[DeprecationWarning] Fixing multiple warnings related to the conversion of arrays with ndim > 0 to scalars. #7863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/dgl/nn/pytorch/explain/subgraphx.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def shapley(self, subgraph_nodes):
device = self.feat.device
for _ in range(self.shapley_steps):
permuted_space = np.random.permutation(coalition_space)
split_idx = int(np.where(permuted_space == split_point)[0])
split_idx = int(np.where(permuted_space == split_point)[0][0])

selected_nodes = permuted_space[:split_idx]

Expand Down Expand Up @@ -490,7 +490,7 @@ def shapley(self, subgraph_nodes):
selected_node_map = dict()
for ntype, nodes in coalition_space.items():
permuted_space = np.random.permutation(nodes)
split_idx = int(np.where(permuted_space == split_point)[0])
split_idx = int(np.where(permuted_space == split_point)[0][0])
selected_node_map[ntype] = permuted_space[:split_idx]

# Mask for coalition set S_i
Expand Down
4 changes: 2 additions & 2 deletions python/dgl/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def networkx2tensor(nx_graph, idtype, edge_id_attr_name=None):
src = [0] * num_edges
dst = [0] * num_edges
for u, v, attr in nx_graph.edges(data=True):
eid = int(attr[edge_id_attr_name])
eid = int(attr[edge_id_attr_name][0])
if eid < 0 or eid >= nx_graph.number_of_edges():
raise DGLError(
"Expect edge IDs to be a non-negative integer smaller than {:d}, "
Expand Down Expand Up @@ -278,7 +278,7 @@ def networkxbipartite2tensors(
"Expect the node {} to have attribute bipartite=1 "
"with edge {}".format(v, (u, v))
)
eid = int(attr[edge_id_attr_name])
eid = int(attr[edge_id_attr_name][0])
if eid < 0 or eid >= nx_graph.number_of_edges():
raise DGLError(
"Expect edge IDs to be a non-negative integer smaller than {:d}, "
Expand Down