Using a target size (torch.Size([80670, 1])) that is different to the input size (torch.Size([80670]))

97 views Asked by At

I want to implement GCN with my own dataset (from Pytorch geometric tutorial). I copied my notebook below. It is working when I use the original implementation, However, if I want to use custom data then it gives the below error:

My notebook

Original implementation

I used Load CSV from pyG and tried to incorporate it into their GCN implementation. I know in the original implementation they used the same dataset but I want to try with custom data (load datasets for later).

Using a target size (torch.Size([80670, 1])) that is different to the input size (torch.Size([80670])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.

The problem arises: Print (data)

HeteroData(
  movie={ x=[9742, 404] },
  user={ num_nodes=610 },
  (user, rates, movie)={
    edge_index=[2, 100836],
    edge_label=[100836] # mine is edge_label=[100836,1]
  }
)

I don't know how to make edge_label=[100836,1] to edge_label=[100836] which will hopefully solve the issue.

Looking forward to the comments.

1

There are 1 answers

0
UrDailyCS On

You can use edge_label = edge_label.squeeze()

it will remove the extra dimension