random_split returns two Datasets with the lengths as specified in the lengths argument:
dataset = TensorDataset(torch.randn(1000, 1))
train_data, val_data = random_split(dataset, [900, 100])
print(len(train_data))
> 900
print(len(val_data))
> 100

train_data[0] # works
train_data[899] # works
train_data[900] # error

val_data[0] # works
val_data[99] # works
val_data[100] # error

Also answered here 14.