Created
October 2, 2018 18:10
-
-
Save goldsborough/0be71b6ca777bb43cd26138faca1591f to your computer and use it in GitHub Desktop.
Revisions
-
goldsborough revised this gist
Oct 2, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #include <torch/torch.h> torch::nn::Linear model(num_features, 1); torch::optim::SGD optimizer(model->parameters()); auto data_loader = torch::data::data_loader(dataset); for (size_t epoch = 0; epoch < 10; ++epoch) { -
goldsborough renamed this gist
Oct 2, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
goldsborough created this gist
Oct 2, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #include <torch/torch.h> torch::nn::Linear model(num_features, 1); torch::optim::SGD optimizer(model.parameters()); auto data_loader = torch::data::data_loader(dataset); for (size_t epoch = 0; epoch < 10; ++epoch) { for (auto batch : data_loader) { auto prediction = model->forward(batch.data); auto loss = loss_function(prediction, batch.target); loss.backward(); optimizer.step(); } }