Skip to content

Commit

Permalink
Merge pull request #73 from fuzic/pytorch_bindings
Browse files Browse the repository at this point in the history
Fix workspace allocation for cpu-mode to have correct size and deallocation
  • Loading branch information
Sean Naren authored Jul 27, 2018
2 parents 7fcbf65 + 025cc42 commit ac045b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytorch_binding/src/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ extern "C" int cpu_ctc(THFloatTensor *probs,
probs_size, minibatch_size,
options, &cpu_size_bytes);

float* cpu_workspace = (float*) new unsigned char[cpu_size_bytes];
float* cpu_workspace = new float[cpu_size_bytes / sizeof(float)];

compute_ctc_loss(probs_ptr, grads_ptr,
labels_ptr, label_sizes_ptr,
sizes_ptr, probs_size,
minibatch_size, costs_ptr,
cpu_workspace, options);

delete cpu_workspace;
delete[] cpu_workspace;
return 1;
}

Expand Down

0 comments on commit ac045b6

Please sign in to comment.