heavyedge-dataset 1.0.0__tar.gz → 1.0.0.post0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {heavyedge_dataset-1.0.0/src/heavyedge_dataset.egg-info → heavyedge_dataset-1.0.0.post0}/PKG-INFO +1 -1
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/pyproject.toml +1 -1
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/src/heavyedge_dataset/__init__.py +30 -6
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0/src/heavyedge_dataset.egg-info}/PKG-INFO +1 -1
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/LICENSE +0 -0
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/README.md +0 -0
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/setup.cfg +0 -0
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/src/heavyedge_dataset.egg-info/SOURCES.txt +0 -0
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/src/heavyedge_dataset.egg-info/dependency_links.txt +0 -0
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/src/heavyedge_dataset.egg-info/requires.txt +0 -0
- {heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/src/heavyedge_dataset.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
"""Package to load
|
1
|
+
"""Package to load edge profile data using PyTorch dataset.
|
2
2
|
|
3
|
-
Refer to `PyTorch tutorial <tutorial>`_ for information about custom
|
3
|
+
Refer to `PyTorch tutorial <tutorial>`_ for information about custom dataset.
|
4
4
|
|
5
5
|
.. _tutorial: https://docs.pytorch.org/tutorials/beginner/data_loading_tutorial.html
|
6
6
|
"""
|
@@ -27,9 +27,6 @@ class ProfileDataset(Dataset):
|
|
27
27
|
N is the number of loaded data, m is dimension of coordinates, and
|
28
28
|
L is the maximum length of profiles.
|
29
29
|
|
30
|
-
Data can be indexed either by a single integer, by a slice, or by a sequence.
|
31
|
-
When a single integer index is used, data do not have the first axis.
|
32
|
-
|
33
30
|
Parameters
|
34
31
|
----------
|
35
32
|
file : heavyedge.ProfileData
|
@@ -45,9 +42,36 @@ class ProfileDataset(Dataset):
|
|
45
42
|
>>> from heavyedge import get_sample_path, ProfileData
|
46
43
|
>>> from heavyedge_dataset import ProfileDataset
|
47
44
|
>>> with ProfileData(get_sample_path("Prep-Type2.h5")) as file:
|
48
|
-
... profiles,
|
45
|
+
... profiles, lengths = ProfileDataset(file, m=2)[:]
|
49
46
|
>>> profiles.shape
|
50
47
|
(22, 2, 3200)
|
48
|
+
>>> lengths.shape
|
49
|
+
(22,)
|
50
|
+
|
51
|
+
Should this dataset be used for :class:`torch.utils.data.DataLoader`,
|
52
|
+
``collate_fn`` argument should be passed to the data loader.
|
53
|
+
|
54
|
+
>>> from torch.utils.data import DataLoader
|
55
|
+
>>> with ProfileData(get_sample_path("Prep-Type2.h5")) as file:
|
56
|
+
... dataset = ProfileDataset(file, m=2)
|
57
|
+
... loader = DataLoader(dataset, collate_fn=lambda x: x)
|
58
|
+
... profiles, lengths = next(iter(loader))
|
59
|
+
>>> profiles.shape
|
60
|
+
(1, 2, 3200)
|
61
|
+
>>> lengths.shape
|
62
|
+
(1,)
|
63
|
+
|
64
|
+
If data should be loaded as :class:`torch.Tensor`, pass ``transform`` argument.
|
65
|
+
|
66
|
+
>>> import torch
|
67
|
+
>>> def to_tensor(sample):
|
68
|
+
... return (torch.from_numpy(sample[0]), torch.from_numpy(sample[1]))
|
69
|
+
>>> with ProfileData(get_sample_path("Prep-Type2.h5")) as file:
|
70
|
+
... dataset = ProfileDataset(file, m=2, transform=to_tensor)
|
71
|
+
... loader = DataLoader(dataset, collate_fn=lambda x: x)
|
72
|
+
... profiles, lengths = next(iter(loader))
|
73
|
+
>>> type(profiles)
|
74
|
+
<class 'torch.Tensor'>
|
51
75
|
"""
|
52
76
|
|
53
77
|
def __init__(self, file, m=1, transform=None):
|
File without changes
|
File without changes
|
File without changes
|
{heavyedge_dataset-1.0.0 → heavyedge_dataset-1.0.0.post0}/src/heavyedge_dataset.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|