Skip to content

Commit 62a7a7d

Browse files
make pytorch optional
1 parent 8e1c826 commit 62a7a7d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sdk/diffgram/pytorch_diffgram/diffgram_pytorch_dataset.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
from torch.utils.data import Dataset, DataLoader
2-
import torch as torch # type: ignore
32
from diffgram.core.diffgram_dataset_iterator import DiffgramDatasetIterator
43

4+
try:
5+
import torch as torch # type: ignore
6+
except ModuleNotFoundError:
7+
raise ModuleNotFoundError(
8+
"'torch' module should be installed to convert the Dataset into torch (pytorch) format"
9+
)
510

611
class DiffgramPytorchDataset(DiffgramDatasetIterator, Dataset):
712

0 commit comments

Comments
 (0)