@@ -19,10 +19,10 @@ namespace caffe {
1919
2020template <>
2121void CPUDevice<float >::gemm(const CBLAS_TRANSPOSE TransA,
22- const CBLAS_TRANSPOSE TransB, const int M,
23- const int N, const int K, const float alpha,
24- const float * A, const float * B,
25- const float beta, float * C) {
22+ const CBLAS_TRANSPOSE TransB, const int M,
23+ const int N, const int K, const float alpha,
24+ const float * A, const float * B, const float beta ,
25+ float * C) {
2626 int lda = (TransA == CblasNoTrans) ? K : M;
2727 int ldb = (TransB == CblasNoTrans) ? N : K;
2828 cblas_sgemm (CblasRowMajor, TransA, TransB, M, N, K, alpha, A, lda, B,
@@ -31,10 +31,10 @@ void CPUDevice<float>::gemm(const CBLAS_TRANSPOSE TransA,
3131
3232template <>
3333void CPUDevice<double >::gemm(const CBLAS_TRANSPOSE TransA,
34- const CBLAS_TRANSPOSE TransB, const int M,
35- const int N, const int K, const double alpha,
36- const double * A, const double * B,
37- const double beta, double * C) {
34+ const CBLAS_TRANSPOSE TransB, const int M,
35+ const int N, const int K, const double alpha,
36+ const double * A, const double * B,
37+ const double beta, double * C) {
3838 int lda = (TransA == CblasNoTrans) ? K : M;
3939 int ldb = (TransB == CblasNoTrans) ? N : K;
4040 cblas_dgemm (CblasRowMajor, TransA, TransB, M, N, K, alpha, A, lda, B,
@@ -43,41 +43,39 @@ void CPUDevice<double>::gemm(const CBLAS_TRANSPOSE TransA,
4343
4444template <>
4545void CPUDevice<float >::gemv(const CBLAS_TRANSPOSE TransA, const int M,
46- const int N, const float alpha,
47- const float * A, const float * x,
48- const float beta, float * y) {
46+ const int N, const float alpha, const float * A,
47+ const float * x, const float beta, float * y) {
4948 cblas_sgemv (CblasRowMajor, TransA, M, N, alpha, A, N, x, 1 , beta, y, 1 );
5049}
5150
5251template <>
5352void CPUDevice<double >::gemv(const CBLAS_TRANSPOSE TransA, const int M,
54- const int N, const double alpha,
55- const double * A, const double * x,
56- const double beta, double * y) {
53+ const int N, const double alpha, const double * A,
54+ const double * x, const double beta, double * y) {
5755 cblas_dgemv (CblasRowMajor, TransA, M, N, alpha, A, N, x, 1 , beta, y, 1 );
5856}
5957
6058template <>
6159void CPUDevice<float >::axpy(const int N, const float alpha, const float * X,
62- float * Y) {
60+ float * Y) {
6361 cblas_saxpy (N, alpha, X, 1 , Y, 1 );
6462}
6563
6664template <>
6765void CPUDevice<double >::axpy(const int N, const double alpha, const double * X,
68- double * Y) {
66+ double * Y) {
6967 cblas_daxpy (N, alpha, X, 1 , Y, 1 );
7068}
7169
7270template <>
7371void CPUDevice<float >::axpby(const int N, const float alpha, const float * X,
74- const float beta, float * Y) {
72+ const float beta, float * Y) {
7573 cblas_saxpby (N, alpha, X, 1 , beta, Y, 1 );
7674}
7775
7876template <>
7977void CPUDevice<double >::axpby(const int N, const double alpha, const double * X,
80- const double beta, double * Y) {
78+ const double beta, double * Y) {
8179 cblas_daxpby (N, alpha, X, 1 , beta, Y, 1 );
8280}
8381
@@ -148,61 +146,61 @@ void CPUDevice<double>::sqr(const int N, const double* a, double* y) {
148146
149147template <>
150148void CPUDevice<float >::add(const int N, const float * a, const float * b,
151- float * y) {
149+ float * y) {
152150 vsAdd (N, a, b, y);
153151}
154152
155153template <>
156154void CPUDevice<double >::add(const int N, const double * a, const double * b,
157- double * y) {
155+ double * y) {
158156 vdAdd (N, a, b, y);
159157}
160158
161159template <>
162160void CPUDevice<float >::sub(const int N, const float * a, const float * b,
163- float * y) {
161+ float * y) {
164162 vsSub (N, a, b, y);
165163}
166164
167165template <>
168166void CPUDevice<double >::sub(const int N, const double * a, const double * b,
169- double * y) {
167+ double * y) {
170168 vdSub (N, a, b, y);
171169}
172170
173171template <>
174172void CPUDevice<float >::mul(const int N, const float * a, const float * b,
175- float * y) {
173+ float * y) {
176174 vsMul (N, a, b, y);
177175}
178176
179177template <>
180178void CPUDevice<double >::mul(const int N, const double * a, const double * b,
181- double * y) {
179+ double * y) {
182180 vdMul (N, a, b, y);
183181}
184182
185183template <>
186184void CPUDevice<float >::div(const int N, const float * a, const float * b,
187- float * y) {
185+ float * y) {
188186 vsDiv (N, a, b, y);
189187}
190188
191189template <>
192190void CPUDevice<double >::div(const int N, const double * a, const double * b,
193- double * y) {
191+ double * y) {
194192 vdDiv (N, a, b, y);
195193}
196194
197195template <>
198196void CPUDevice<float >::powx(const int N, const float * a, const float b,
199- float * y) {
197+ float * y) {
200198 vsPowx (N, a, b, y);
201199}
202200
203201template <>
204202void CPUDevice<double >::powx(const int N, const double * a, const double b,
205- double * y) {
203+ double * y) {
206204 vdPowx (N, a, b, y);
207205}
208206
@@ -213,8 +211,8 @@ static Dtype _nextafter(const Dtype b) {
213211}
214212
215213template <typename Dtype>
216- void CPUDevice<Dtype>::rng_uniform(const int N, const Dtype a,
217- const Dtype b, Dtype* r) {
214+ void CPUDevice<Dtype>::rng_uniform(const int N, const Dtype a, const Dtype b,
215+ Dtype* r) {
218216 CHECK_GE (N, 0 );
219217 CHECK (r);
220218 CHECK_LE (a, b);
@@ -228,7 +226,7 @@ void CPUDevice<Dtype>::rng_uniform(const int N, const Dtype a,
228226
229227template <typename Dtype>
230228void CPUDevice<Dtype>::rng_gaussian(const int N, const Dtype mu,
231- const Dtype sigma, Dtype* r) {
229+ const Dtype sigma, Dtype* r) {
232230 CHECK_GE (N, 0 );
233231 CHECK (r);
234232 CHECK_GT (sigma, 0 );
@@ -256,7 +254,7 @@ void CPUDevice<Dtype>::rng_bernoulli(const int N, const Dtype p, int* r) {
256254
257255template <typename Dtype>
258256void CPUDevice<Dtype>::rng_bernoulli(const int N, const Dtype p,
259- unsigned int * r) {
257+ unsigned int * r) {
260258 CHECK_GE (N, 0 );
261259 CHECK (r);
262260 CHECK_GE (p, 0 );
@@ -281,19 +279,19 @@ void CPUDevice<double>::exp(const int N, const double* a, double* y) {
281279
282280template <>
283281void CPUDevice<float >::dot(const int N, const float * x, const float * y,
284- float * out) {
282+ float * out) {
285283 *out = cblas_sdot (N, x, 1 , y, 1 );
286284}
287285
288286template <>
289287void CPUDevice<double >::dot(const int N, const double * x, const double * y,
290- double * out) {
288+ double * out) {
291289 *out = cblas_ddot (N, x, 1 , y, 1 );
292290}
293291
294292template <>
295293uint32_t CPUDevice<float >::hamming_distance(const int N, const float * x,
296- const float * y) {
294+ const float * y) {
297295 uint32_t dist = 0 ;
298296 for (int i = 0 ; i < N; ++i) {
299297 dist += __builtin_popcount (static_cast <uint32_t >(x[i]) ^
@@ -366,22 +364,23 @@ void CPUDevice<Dtype>::fabs(const int N, const Dtype* x, Dtype* y) {
366364
367365template <>
368366void CPUDevice<float >::scale(const int N, const float alpha, const float *x,
369- float * y) {
367+ float * y) {
370368 cblas_scopy (N, x, 1 , y, 1 );
371369 cblas_sscal (N, alpha, y, 1 );
372370}
373371
374372template <>
375373void CPUDevice<double >::scale(const int N, const double alpha, const double *x,
376- double * y) {
374+ double * y) {
377375 cblas_dcopy (N, x, 1 , y, 1 );
378376 cblas_dscal (N, alpha, y, 1 );
379377}
380378
381379template <typename Dtype>
382380void CPUDevice<Dtype>::im2col(const Dtype* data_im, const int channels,
383- const int height, const int width, const int ksize, const int pad,
384- const int stride, Dtype* data_col) {
381+ const int height, const int width,
382+ const int ksize, const int pad, const int stride,
383+ Dtype* data_col) {
385384 int height_col = (height + 2 * pad - ksize) / stride + 1 ;
386385 int width_col = (width + 2 * pad - ksize) / stride + 1 ;
387386 int channels_col = channels * ksize * ksize;
@@ -405,8 +404,9 @@ void CPUDevice<Dtype>::im2col(const Dtype* data_im, const int channels,
405404
406405template <typename Dtype>
407406void CPUDevice<Dtype>::col2im(const Dtype* data_col, const int channels,
408- const int height, const int width, const int ksize, const int pad,
409- const int stride, Dtype* data_im) {
407+ const int height, const int width,
408+ const int ksize, const int pad, const int stride,
409+ Dtype* data_im) {
410410 memset (data_im, 0 , sizeof (Dtype) * height * width * channels);
411411 int height_col = (height + 2 * pad - ksize) / stride + 1 ;
412412 int width_col = (width + 2 * pad - ksize) / stride + 1 ;
0 commit comments