MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / random_dataset

Function random_dataset

tests/unit/simple_model.py:268–272  ·  view source on GitHub ↗
(total_samples, hidden_dim, device, dtype=preferred_dtype())

Source from the content-addressed store, hash-verified

266
267
268def random_dataset(total_samples, hidden_dim, device, dtype=preferred_dtype()):
269 train_data = torch.randn(total_samples, hidden_dim, device=device, dtype=dtype)
270 train_label = torch.empty(total_samples, dtype=torch.long, device=device).random_(hidden_dim)
271 train_dataset = torch.utils.data.TensorDataset(train_data, train_label)
272 return train_dataset
273
274
275def random_dataloader(model, total_samples, hidden_dim, device, dtype=preferred_dtype()):

Callers 3

testMethod · 0.90
random_dataloaderFunction · 0.85

Calls 1

preferred_dtypeFunction · 0.85

Tested by 2

testMethod · 0.72