"Tesla") device_by_name(
device(type='cuda', index=0)
device_by_name (name:str)
Return reference to cuda device by using Part of it’s name
Args: name: part of the cuda device name (shuuld be distinct)
Return: Reference to cuda device
Updated: Yuval 12/10/19
If the device doesn’t exist we should get an error
DatasetCat (*datasets)
Concatenate datasets for Pytorch dataloader
The normal pytorch implementation does it only for raws. this is a “column” implementation
Arges: datasets: list of datasets, of the same length
Updated: Yuval 12/10/2019
This is one dataset
dataset1=torch.utils.data.TensorDataset(torch.ones(5,1),torch.randn(5,1))
print(len(dataset1))
print (dataset1.__getitem__(0))
5
(tensor([1.]), tensor([-1.2270]))
This is the 2nd
dataset2=torch.utils.data.TensorDataset(torch.zeros(5,1),torch.randn(5,1))
print(len(dataset2))
print (dataset2.__getitem__(0))
5
(tensor([0.]), tensor([1.0632]))
And we will concat them row wise