Skip to content

Commit

Permalink
Add CPU sqrt functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdonahue committed Apr 13, 2017
1 parent e93fcd2 commit ab33988
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/caffe/util/math_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ void caffe_scal(const int N, const Dtype alpha, Dtype *X);
template <typename Dtype>
void caffe_sqr(const int N, const Dtype* a, Dtype* y);

template <typename Dtype>
void caffe_sqrt(const int N, const Dtype* a, Dtype* y);

template <typename Dtype>
void caffe_add(const int N, const Dtype* a, const Dtype* b, Dtype* y);

Expand Down
10 changes: 10 additions & 0 deletions src/caffe/util/math_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@ void caffe_sqr<double>(const int n, const double* a, double* y) {
vdSqr(n, a, y);
}

template <>
void caffe_sqrt<float>(const int n, const float* a, float* y) {
vsSqrt(n, a, y);
}

template <>
void caffe_sqrt<double>(const int n, const double* a, double* y) {
vdSqrt(n, a, y);
}

template <>
void caffe_exp<float>(const int n, const float* a, float* y) {
vsExp(n, a, y);
Expand Down

0 comments on commit ab33988

Please sign in to comment.