cshjin / swmp_ml

Other
2 stars 0 forks source link

Handle missing index in some matpower config files #10

Closed cshjin closed 1 year ago

cshjin commented 1 year ago
Traceback (most recent call last):
  File "test_dataset.py", line 46, in <module>
    output = model(data)
  File "/home/jinh/miniconda3/envs/swmp/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "test_dataset.py", line 24, in forward
    x = self.conv1(x, edge_index)
  File "/home/jinh/miniconda3/envs/swmp/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/jinh/miniconda3/envs/swmp/lib/python3.8/site-packages/torch_geometric/nn/conv/sage_conv.py", line 131, in forward
    out = self.propagate(edge_index, x=x, size=size)
  File "/home/jinh/miniconda3/envs/swmp/lib/python3.8/site-packages/torch_geometric/nn/conv/message_passing.py", line 366, in propagate
    coll_dict = self.__collect__(self.__user_args__, edge_index,
  File "/home/jinh/miniconda3/envs/swmp/lib/python3.8/site-packages/torch_geometric/nn/conv/message_passing.py", line 260, in __collect__
    data = self.__lift__(data, edge_index, dim)
  File "/home/jinh/miniconda3/envs/swmp/lib/python3.8/site-packages/torch_geometric/nn/conv/message_passing.py", line 230, in __lift__
    return src.index_select(self.node_dim, index)
IndexError: index out of range in self

This is due to the missing index from bus are not handled in branch and gen

cshjin commented 1 year ago

Fixed in https://github.com/cshjin/swmp_ml/blob/72abc200f862f73125bced90364875297e3bf5a4/py_script/dataset.py#L72-L76

Close for now.