combined_source_and_target
CombinedSourceAndTargetDataset
¶
Bases: torch.utils.data.Dataset
Wraps a source dataset and a target dataset.
Source code in pytorch_adapt\datasets\combined_source_and_target.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
__getitem__(idx)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idx |
The index of the target dataset. The source index is picked randomly. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
A dictionary containing both source and target data.
The source keys start with |
Source code in pytorch_adapt\datasets\combined_source_and_target.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
__init__(source_dataset, target_dataset)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_dataset |
SourceDataset
|
required | |
target_dataset |
TargetDataset
|
required |
Source code in pytorch_adapt\datasets\combined_source_and_target.py
16 17 18 19 20 21 22 23 24 | |
__len__()
¶
Returns:
| Type | Description |
|---|---|
int
|
The length of the target dataset. |
Source code in pytorch_adapt\datasets\combined_source_and_target.py
26 27 28 29 30 31 | |