[dataset] simplify imports
@@ -25,21 +25,16 @@ from torch.utils.data.dataloader import default_collate
from torch.utils.data.dataset import Dataset, Subset, ConcatDataset
from torchvision.transforms import Compose
-from .dataset_definitions import ITensorDataset, ClassificationDataset, \
- IDatasetWithTargets, ISupportedClassificationDataset
from .dataset_utils import manage_advanced_indexing, \
SequenceDataset, ClassificationSubset, \
LazyConcatIntTargets, find_list_from_index, ConstantSequence, \
LazyClassMapping, optimize_sequence, SubSequence, LazyConcatTargets, \
TupleTLabel
+from .dataset_definitions import ITensorDataset, ClassificationDataset, \
+ IDatasetWithTargets, ISupportedClassificationDataset
-try:
- from typing import List, Any, Iterable, Sequence, Union, Optional, \
- TypeVar, Protocol, SupportsInt, Generic, Callable, Dict, Tuple, \
- Literal, Collection
-except ImportError:
- from typing import List, Any, Iterable, Sequence, Union, Optional, \
- TypeVar, SupportsInt, Generic, Callable, Dict, Tuple, Collection
+from typing import List, Any, Sequence, Union, Optional, TypeVar, SupportsInt, \
+ Callable, Dict, Tuple, Collection
T_co = TypeVar('T_co', covariant=True)
TTargetType = TypeVar('TTargetType')
@@ -95,7 +90,6 @@ class AvalancheDataset(IDatasetWithTargets[T_co, TTargetType], Dataset[T_co]):
parameter, each pattern will be assigned a default task label "0".
See the constructor for more details.
"""
-
def __init__(self,
dataset: SupportedDataset,
*,
@@ -1035,7 +1029,6 @@ class AvalancheSubset(AvalancheDataset[T_co, TTargetType]):
the targets field, class mapping and all the other goodies listed in
:class:`AvalancheDataset`.
"""
-
def __init__(self,
dataset: SupportedDataset,
indices: Sequence[int] = None,
@@ -1389,7 +1382,6 @@ class AvalancheTensorDataset(AvalancheDataset[T_co, TTargetType]):
the targets field and all the other goodies listed in
:class:`AvalancheDataset`.
"""
-
def __init__(self,
*dataset_tensors: Sequence,
transform: Callable[[Any], Any] = None,
@@ -1496,7 +1488,6 @@ class AvalancheConcatDataset(AvalancheDataset[T_co, TTargetType]):
and transformations groups are consistent across the concatenated dataset
(if they are subclasses of :class:`AvalancheDataset`).
"""
-
def __init__(self,
datasets: Collection[SupportedDataset],
*,
