dgl icon indicating copy to clipboard operation
dgl copied to clipboard

remove edge in local_scope causes a bug

Open chenjy1 opened this issue 3 years ago • 1 comments

🐛 Bug

To Reproduce

Steps to reproduce the behavior:

g = dgl.graph(([0, 1, 1, 2, 2, 3], [1, 2, 3, 3, 4, 5]))
g.edata['x'] = torch.ones(g.num_edges())

with g.local_scope():
    g.remove_edges(torch.tensor([1]))

g.edata['z'] = torch.ones(g.num_edges())

The remove_edges op is supposed to remove the edata also, but due to the local_scope it failed. And the mismatch of the two edata will cause an error.

Expected behavior

Environment

  • DGL Version (e.g., 1.0):
  • Backend Library & Version (e.g., PyTorch 0.4.1, MXNet/Gluon 1.3):
  • OS (e.g., Linux):
  • How you installed DGL (conda, pip, source):
  • Build command you used (if compiling from source):
  • Python version:
  • CUDA/cuDNN version (if applicable):
  • GPU models and configuration (e.g. V100):
  • Any other relevant information:

Additional context

chenjy1 avatar Sep 27 '22 14:09 chenjy1

Sorry we don't document it clearly: Graph mutation is not supported in the local_scope.

peizhou001 avatar Oct 10 '22 07:10 peizhou001