| 50 | }; |
| 51 | |
| 52 | void Cifar10::ReadImage(std::ifstream* file, int* label, char* buffer) { |
| 53 | char label_char; |
| 54 | file->read(&label_char, 1); |
| 55 | *label = static_cast<int>(label_char); |
| 56 | file->read(buffer, kImageVol); |
| 57 | return; |
| 58 | } |
| 59 | const std::pair<Tensor, Tensor> Cifar10::ReadFile(string file) { |
| 60 | Tensor images(Shape{kBatchSize, 3, kImageSize, kImageSize}); |
| 61 | Tensor labels(Shape{kBatchSize}, kInt); |