(total_samples, hidden_dim, device, dtype=preferred_dtype())
| 266 | |
| 267 | |
| 268 | def 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 | |
| 275 | def random_dataloader(model, total_samples, hidden_dim, device, dtype=preferred_dtype()): |