Skip to content

Instantly share code, notes, and snippets.

@mdfarragher
Created December 12, 2019 12:44
Show Gist options
  • Save mdfarragher/5487bbc974dca26d9503681dd4488f98 to your computer and use it in GitHub Desktop.
Save mdfarragher/5487bbc974dca26d9503681dd4488f98 to your computer and use it in GitHub Desktop.
// create the batch to train on
var trainingBatch = StyleTransfer.CreateBatch(lossFunction, labels);
// train the model
Console.WriteLine("Training the model...");
var numEpochs = 300;
for (int i = 0; i < numEpochs; i++)
{
trainer.TrainMinibatch(trainingBatch, true, NetUtil.CurrentDevice);
if (i % 50 == 0)
Console.WriteLine($"epoch {i}, training loss = {trainer.PreviousMinibatchLossAverage()}");
}
// the rest of the code goes here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment