Open frederick-greenacademy opened 4 years ago
Yeah, I haven't updated the syntax in this example for a while. Think the last toolchain I had this building with was 0.4.
I'll also need to modernize this for current use of image loading / saving, checkpoint restoration, and other things we've added since I last looked in on this. Thanks for the reminder, though.
Swift: 5.0.1 - Xcode: 11.3.1 Toolchain: Swift for Tensorflow 0.9
`for epochNumber in 0..<100 { let shuffledDataset = trainingImageDataset.combinedDataset.shuffled(sampleCount: 60, randomSeed: Int64(epochNumber)).batched(60) for datasetItem in shuffledDataset { let (currentLoss, gradients) = valueWithGradient(at: alexNet) { model -> Tensor in
return loss(model: model, images: datasetItem.first, labels: datasetItem.second)
}
} let endTime = -startTime.timeIntervalSinceNow`