Skip to content

Commit

Permalink
delete resize
Browse files Browse the repository at this point in the history
  • Loading branch information
RParedesPalacios committed Jan 20, 2021
1 parent 5ad0c83 commit 19a50a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/nn/4_NLP/3_nlp_machine_translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ int main(int argc, char **argv) {
opt, // Optimizer
{"softmax_cross_entropy"}, // Losses
{"accuracy"}, // Metrics
//CS_GPU({1}) // one GPU
CS_GPU({1}) // one GPU
//CS_GPU({1,1},100) // two GPU with weight sync every 100 batches
CS_CPU()
//CS_CPU()
);


Expand Down
6 changes: 3 additions & 3 deletions examples/nn/4_NLP/5_nlp_text_generation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char **argv) {
download_flickr();

// Settings
int epochs = 0;
int epochs = 100;
int batch_size = 24;

int olength=20;
Expand Down Expand Up @@ -120,9 +120,9 @@ int main(int argc, char **argv) {
opt, // Optimizer
{"softmax_cross_entropy"}, // Losses
{"accuracy"}, // Metrics
//CS_GPU({1}) // one GPU
CS_GPU({1}) // one GPU
//CS_GPU({1,1},100) // two GPU with weight sync every 100 batches
CS_CPU()
//CS_CPU()
);

// View model
Expand Down
3 changes: 2 additions & 1 deletion src/tensor/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void Tensor::deleteData(){
else if (this->isGPU())
{
gpu_delete_tensor(this->gpu_device, this->ptr);
//cout<<"delete here"<<endl;
}
#endif
#ifdef cFPGA
Expand Down Expand Up @@ -585,6 +586,6 @@ void Tensor::resize(int b, float *fptr, void *fptr2, bool delete_data) {
updateShape(new_shape);
updateSize();
updateStrides();
if (fptr != nullptr && delete_data) deleteData(); // Potential error on layers such as Reshape (passed pointer)
if (!isshared && delete_data) deleteData(); // Potential error on layers such as Reshape (passed pointer)
updateData(fptr, fptr2);
}

0 comments on commit 19a50a6

Please sign in to comment.