(total_samples, hidden_dim, device, dtype=preferred_dtype())
| 243 | |
| 244 | |
| 245 | def 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 | |
| 252 | def random_dataloader(model, total_samples, hidden_dim, device, dtype=preferred_dtype()): |