Skip to content

Commit

Permalink
Cleaned up the code
Browse files Browse the repository at this point in the history
  • Loading branch information
rystylee committed Nov 15, 2019
1 parent b97023e commit 00ef5da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/models/BigGAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ void BigGAN::stepNoise(const float truncation)
mNoiseStepCounter += 1.0f;
}

void BigGAN::randomizeNoise(const float truncation)
{
mNoiseTensor = truncatedNoiseSample({ mBatchSize, mDimZ }, truncation);
}

at::Tensor BigGAN::truncatedNoiseSample(c10::IntArrayRef size, const float truncation)
{
at::Tensor noise = torch::zeros(size, at::TensorOptions(at::kFloat)).to(*mDevice.get());
Expand Down
1 change: 1 addition & 0 deletions src/models/BigGAN.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class BigGAN final : public BaseModel
//void forward(ofFloatImage& img, const int classIndex, at::Tensor& noiseTensor, const float truncation=0.4f);
void stepClass();
void stepNoise(const float truncation=0.4f);
void randomizeNoise(const float truncation=0.4f);

static inline void denormalize_(at::Tensor& tensor)
{
Expand Down
2 changes: 0 additions & 2 deletions src/models/VGG16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class VGG16 final : public BaseModel
public:
VGG16();
void init(const std::string& modelPath);
//std::pair<int, float> forward(const ofFbo& inputFbo);
//std::pair<int, at::Tensor> forward(const ofFbo& inputFbo);

template <typename T>
T forward(const ofFbo& inputFbo);
Expand Down

0 comments on commit 00ef5da

Please sign in to comment.