Hi everyone!
I have my own torch_geometric.data Dataset, that includes targets as well. What is the better way to “pop” the targets from it so I can have everything but targets in Dataset?
Hi everyone!
I have my own torch_geometric.data Dataset, that includes targets as well. What is the better way to “pop” the targets from it so I can have everything but targets in Dataset?
I’m not sure which Dataset
you are using, but e.g. torch_geometric.data.Data
uses an optional target attribute so I would assume you don’t need to pass it to the dataset while creating it.
I have something similar to gvp-pytorch/data.py at main · drorlab/gvp-pytorch · GitHub, but with targets
data = torch_geometric.data.Data(x=X_ca, seq=seq, name=name,
node_s=node_s, node_v=node_v,
edge_s=edge_s, edge_v=edge_v,
edge_index=edge_index, mask=mask,
targets=targets)
my question is I need to split this to data and targets, what is the best practice?
to get targets only i can use data[“targets”], but how to get everything else but targets?
torch_geometric.data.Data(x=X_ca, seq=seq, name=name,
node_s=node_s, node_v=node_v,
edge_s=edge_s, edge_v=edge_v,
edge_index=edge_index, mask=mask)
Solved it that way
targets = data["target"]
delattr(data,"target")
x = data