Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
philkr committed Jan 6, 2016
1 parent 208a392 commit b109a57
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/caffe/solvers/adadelta_solver.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
namespace caffe {

template <typename Dtype>
__global__ void adadelta_update_device(int N, Dtype* g, Dtype* h, Dtype* h2,
__global__ void AdaDeltaUpdate(int N, Dtype* g, Dtype* h, Dtype* h2,
Dtype momentum, Dtype delta, Dtype local_rate) {
CUDA_KERNEL_LOOP(i, N) {
float gi = g[i];
float hi = h[i] = momentum * h[i] + (1-momentum) * gi * gi;
gi = gi * sqrt( (h2[i] + delta) / (hi + delta) );
gi = gi * sqrt((h2[i] + delta) / (hi + delta));
h2[i] = momentum * h2[i] + (1-momentum) * gi * gi;
g[i] = local_rate * gi;
}
}
template <typename Dtype>
void adadelta_update_gpu(int N, Dtype* g, Dtype* h, Dtype* h2, Dtype momentum,
Dtype delta, Dtype local_rate) {
adadelta_update_device<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
AdaDeltaUpdate<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
<<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>(
N, g, h, h2, momentum, delta, local_rate);
CUDA_POST_KERNEL_CHECK;
Expand Down
4 changes: 2 additions & 2 deletions src/caffe/solvers/adagrad_solver.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace caffe {

template <typename Dtype>
__global__ void adagrad_update_device(int N, Dtype* g, Dtype* h, Dtype delta,
__global__ void AdaGradUpdate(int N, Dtype* g, Dtype* h, Dtype delta,
Dtype local_rate) {
CUDA_KERNEL_LOOP(i, N) {
float gi = g[i];
Expand All @@ -15,7 +15,7 @@ __global__ void adagrad_update_device(int N, Dtype* g, Dtype* h, Dtype delta,
template <typename Dtype>
void adagrad_update_gpu(int N, Dtype* g, Dtype* h, Dtype delta,
Dtype local_rate) {
adagrad_update_device<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
AdaGradUpdate<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
<<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>(
N, g, h, delta, local_rate);
CUDA_POST_KERNEL_CHECK;
Expand Down
4 changes: 2 additions & 2 deletions src/caffe/solvers/adam_solver.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace caffe {

template <typename Dtype>
__global__ void adam_update_device(int N, Dtype* g, Dtype* m, Dtype* v,
__global__ void AdamUpdate(int N, Dtype* g, Dtype* m, Dtype* v,
Dtype beta1, Dtype beta2, Dtype eps_hat, Dtype corrected_local_rate) {
CUDA_KERNEL_LOOP(i, N) {
float gi = g[i];
Expand All @@ -16,7 +16,7 @@ __global__ void adam_update_device(int N, Dtype* g, Dtype* m, Dtype* v,
template <typename Dtype>
void adam_update_gpu(int N, Dtype* g, Dtype* m, Dtype* v, Dtype beta1,
Dtype beta2, Dtype eps_hat, Dtype corrected_local_rate) {
adam_update_device<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
AdamUpdate<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
<<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>(
N, g, m, v, beta1, beta2, eps_hat, corrected_local_rate);
CUDA_POST_KERNEL_CHECK;
Expand Down
4 changes: 2 additions & 2 deletions src/caffe/solvers/nesterov_solver.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace caffe {

template <typename Dtype>
__global__ void nesterov_update_device(int N, Dtype* g, Dtype* h,
__global__ void NesterovUpdate(int N, Dtype* g, Dtype* h,
Dtype momentum, Dtype local_rate) {
CUDA_KERNEL_LOOP(i, N) {
float hi = h[i];
Expand All @@ -15,7 +15,7 @@ __global__ void nesterov_update_device(int N, Dtype* g, Dtype* h,
template <typename Dtype>
void nesterov_update_gpu(int N, Dtype* g, Dtype* h, Dtype momentum,
Dtype local_rate) {
nesterov_update_device<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
NesterovUpdate<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
<<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>(
N, g, h, momentum, local_rate);
CUDA_POST_KERNEL_CHECK;
Expand Down
4 changes: 2 additions & 2 deletions src/caffe/solvers/rmsprop_solver.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace caffe {

template <typename Dtype>
__global__ void rmsprop_update_device(int N, Dtype* g, Dtype* h,
__global__ void RMSPropUpdate(int N, Dtype* g, Dtype* h,
Dtype rms_decay, Dtype delta, Dtype local_rate) {
CUDA_KERNEL_LOOP(i, N) {
float gi = g[i];
Expand All @@ -15,7 +15,7 @@ __global__ void rmsprop_update_device(int N, Dtype* g, Dtype* h,
template <typename Dtype>
void rmsprop_update_gpu(int N, Dtype* g, Dtype* h, Dtype rms_decay,
Dtype delta, Dtype local_rate) {
rmsprop_update_device<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
RMSPropUpdate<Dtype> // NOLINT_NEXT_LINE(whitespace/operators)
<<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>(
N, g, h, rms_decay, delta, local_rate);
CUDA_POST_KERNEL_CHECK;
Expand Down

0 comments on commit b109a57

Please sign in to comment.