torchdrug
torchdrug copied to clipboard
Retrosynthesis synthon completion issue for batch size=64
After splitting the initial dataset and working with 1000 molecules I got an error for the Synthon Completion task when taking batch_size=64. The error was in the function _get_offsets in the folder graph in datasets. To be more precise, the error was in case of working with empty graphs. it wrote: "repeat interleave cpu" not implemented for 'Float' So, eventually, I resolved the issue by inserting
if num_nodes.size()==torch.Size([0]):
if num_edges.size()==torch.Size([0]):
num_nodes=torch.empty(0, dtype=torch.int64)
num_edges=torch.empty(0, dtype=torch.int64)
num_cum_nodes=torch.empty(0, dtype=torch.int64)
And also the same code into the SynthonCompletion task to assign dtype=torch.int64 to empty tensors. However, it's not such a nice solution... So perhaps you will come up with smth smarter.