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

Function random_dataset

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

Source from the content-addressed store, hash-verified

243
244
245def random_dataset(total_samples, hidden_dim, device, dtype=preferred_dtype()):
246 train_data = torch.randn(total_samples, hidden_dim, device=device, dtype=dtype)
247 train_label = torch.empty(total_samples, dtype=torch.long, device=device).random_(hidden_dim)
248 train_dataset = torch.utils.data.TensorDataset(train_data, train_label)
249 return train_dataset
250
251
252def random_dataloader(model, total_samples, hidden_dim, device, dtype=preferred_dtype()):

Callers 4

testMethod · 0.90
random_dataloaderFunction · 0.85

Calls 1

preferred_dtypeFunction · 0.85

Tested by 3

testMethod · 0.72