compiles on valhalla and doesn't segfault

This commit is contained in:
Hieu Hoang 2016-09-15 15:39:49 +01:00
parent 88678e59bc
commit 78f85fcfa4
2 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,4 @@
#include <ctime>
#include <algorithm>
#include <vector>
#include "sgd.h"
@ -32,7 +33,8 @@ void SGD::Run()
Tensor xt({(int)maxBatchSize_, (int)numExamples}, 0.0f);
Tensor yt({(int)maxBatchSize_, (int)numClasses_}, 0.0f);
vector<size_t> shuffle = CreateShuffle(numExamples);
//vector<size_t> shuffle = CreateShuffle(numExamples);
vector<size_t> shuffle;
for (size_t numEpoch = 0; numEpoch < epochs_; ++numEpoch) {
std::cerr << "Starting epoch #" << numEpoch << std::endl;

View File

@ -20,9 +20,9 @@ class SGD {
void Run();
private:
std::shared_ptr<Expr> cost_function_;
std::shared_ptr<Expr> inX_;
std::shared_ptr<Expr> inY_;
Expr *cost_function_;
Expr *inX_;
Expr *inY_;
std::vector<Expr*> params_;
const float eta_;
std::vector<float>& xData_;