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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: heavyedge-dataset
3
- Version: 1.0.0
3
+ Version: 1.0.0.post0
4
4
  Summary: PyTorch-compatible edge profile dataset API
5
5
  Author-email: Jisoo Song <jeesoo9595@snu.ac.kr>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "heavyedge-dataset"
7
- version = "1.0.0"
7
+ version = "1.0.0.post0"
8
8
  authors = [
9
9
  {name = "Jisoo Song", email = "jeesoo9595@snu.ac.kr"}
10
10
  ]
@@ -1,6 +1,6 @@
1
- """Package to load :class:`heavyedge.ProfileData` using PyTorch dataset scheme.
1
+ """Package to load edge profile data using PyTorch dataset.
2
2
 
3
- Refer to `PyTorch tutorial <tutorial>`_ for information about custom PyTorch dataset.
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, _ = ProfileDataset(file, m=2)[:]
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: heavyedge-dataset
3
- Version: 1.0.0
3
+ Version: 1.0.0.post0
4
4
  Summary: PyTorch-compatible edge profile dataset API
5
5
  Author-email: Jisoo Song <jeesoo9595@snu.ac.kr>
6
6
  License-Expression: MIT