// Copyright 2013 Yangqing Jia #ifndef CAFFE_UTIL_MATH_FUNCTIONS_H_ #define CAFFE_UTIL_MATH_FUNCTIONS_H_ #include #include namespace caffe { // Decaf gemm provides a simpler interface to the gemm functions, with the // limitation that the data has to be contiguous in memory. template void caffe_cpu_gemm(const CBLAS_TRANSPOSE TransA, const CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, const Dtype alpha, const Dtype* A, const Dtype* B, const Dtype beta, Dtype* C); // Decaf gpu gemm provides an interface that is almost the same as the cpu // gemm function - following the c convention and calling the fortran-order // gpu code under the hood. template void caffe_gpu_gemm(const CBLAS_TRANSPOSE TransA, const CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, const Dtype alpha, const Dtype* A, const Dtype* B, const Dtype beta, Dtype* C); template void caffe_cpu_gemv(const CBLAS_TRANSPOSE TransA, const int M, const int N, const Dtype alpha, const Dtype* A, const Dtype* x, const Dtype beta, Dtype* y); template void caffe_gpu_gemv(const CBLAS_TRANSPOSE TransA, const int M, const int N, const Dtype alpha, const Dtype* A, const Dtype* x, const Dtype beta, Dtype* y); template void caffe_axpy(const int N, const Dtype alpha, const Dtype* X, Dtype* Y); template void caffe_axpby(const int N, const Dtype alpha, const Dtype* X, const Dtype beta, Dtype* Y); template void caffe_copy(const int N, const Dtype *X, Dtype *Y); template void caffe_scal(const int N, const Dtype alpha, Dtype *X); template void caffe_gpu_scal(const int N, const Dtype alpha, Dtype *X); template void caffe_sqr(const int N, const Dtype* a, Dtype* y); template void caffe_add(const int N, const Dtype* a, const Dtype* b, Dtype* y); template void caffe_sub(const int N, const Dtype* a, const Dtype* b, Dtype* y); template void caffe_mul(const int N, const Dtype* a, const Dtype* b, Dtype* y); template void caffe_div(const int N, const Dtype* a, const Dtype* b, Dtype* y); template void caffe_powx(const int n, const Dtype* a, const Dtype b, Dtype* y); template void caffe_vRngUniform(const int n, Dtype* r, const Dtype a, const Dtype b); template void caffe_vRngGaussian(const int n, Dtype* r, const Dtype a, const Dtype sigma); template void caffe_exp(const int n, const Dtype* a, Dtype* y); template Dtype caffe_cpu_dot(const int n, const Dtype* x, const Dtype* y); } // namespace caffe #endif // CAFFE_UTIL_MATH_FUNCTIONS_H_