diff options
author | Xiaomeng Yang <yangxm@fb.com> | 2019-02-07 18:19:46 -0800 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-02-07 18:38:26 -0800 |
commit | 2db847b3a7edc48652e144e7c9d7aa0bbed66aaa (patch) | |
tree | 3d95b2f625ca878f038092dea671a2bffed088c6 /caffe2/utils/math.h | |
parent | 22477c6a7fc327cdf913751ab31b788ec710caa9 (diff) | |
download | pytorch-2db847b3a7edc48652e144e7c9d7aa0bbed66aaa.tar.gz pytorch-2db847b3a7edc48652e144e7c9d7aa0bbed66aaa.tar.bz2 pytorch-2db847b3a7edc48652e144e7c9d7aa0bbed66aaa.zip |
Separate elementwise level2 math functions (#16753)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16753
Separate elementwise level2 math functions
i-am-not-moving-c2-to-c10
Reviewed By: houseroad
Differential Revision: D13954928
fbshipit-source-id: 1ca7a5d3da96e32510f502e5e4e79168854bee67
Diffstat (limited to 'caffe2/utils/math.h')
-rw-r--r-- | caffe2/utils/math.h | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/caffe2/utils/math.h b/caffe2/utils/math.h index f870c3d0f8..2ea960176a 100644 --- a/caffe2/utils/math.h +++ b/caffe2/utils/math.h @@ -15,9 +15,10 @@ extern "C" { #include "caffe2/core/common.h" #include "caffe2/core/types.h" +#include "caffe2/utils/math/broadcast.h" #include "caffe2/utils/math/elementwise.h" #include "caffe2/utils/math/reduce.h" -#include "caffe2/utils/math_utils.h" +#include "caffe2/utils/math/utils.h" namespace caffe2 { @@ -31,9 +32,6 @@ class CAFFE2_API DefaultEngine {}; namespace math { #define C10_DECLARE_COMPARE_OP(Comp) \ - template <typename T, class Context> \ - void Comp(const int N, const T* A, const T* B, bool* C, Context* context); \ - \ template <typename T, class Context, bool kBroadcast1st = false> \ void Rowwise##Comp( \ const int rows, \ @@ -72,37 +70,34 @@ C10_DECLARE_COMPARE_OP(GE) #undef C10_DECLARE_COMPARE_OP -#define C10_DECLARE_BINARY_OP(Func) \ - template <typename T, class Context> \ - void Func(const int N, const T* A, const T* B, T* C, Context* context); \ - \ - template <typename T, class Context, bool kBroadcast1st = false> \ - void Rowwise##Func( \ - const int rows, \ - const int cols, \ - const T* A, \ - const T* B, \ - T* C, \ - Context* context); \ - \ - template <typename T, class Context, bool kBroadcast1st = false> \ - void Colwise##Func( \ - const int rows, \ - const int cols, \ - const T* A, \ - const T* B, \ - T* C, \ - Context* context); \ - \ - template <typename T, class Context> \ - void Func( \ - const int A_ndim, \ - const int* A_dims, \ - const int B_ndim, \ - const int* B_dims, \ - const T* A, \ - const T* B, \ - T* C, \ +#define C10_DECLARE_BINARY_OP(Func) \ + template <typename T, class Context, bool kBroadcast1st = false> \ + void Rowwise##Func( \ + const int rows, \ + const int cols, \ + const T* A, \ + const T* B, \ + T* C, \ + Context* context); \ + \ + template <typename T, class Context, bool kBroadcast1st = false> \ + void Colwise##Func( \ + const int rows, \ + const int cols, \ + const T* A, \ + const T* B, \ + T* C, \ + Context* context); \ + \ + template <typename T, class Context> \ + void Func( \ + const int A_ndim, \ + const int* A_dims, \ + const int B_ndim, \ + const int* B_dims, \ + const T* A, \ + const T* B, \ + T* C, \ Context* context); C10_DECLARE_BINARY_OP(Add) @@ -238,11 +233,6 @@ template <typename T, class Context> CAFFE2_API void ColwiseMax(const int N, const int D, const T* x, T* y, Context* context); -// Elemwise maximum of vector x and vector y. z[i] = max(x[i], y[i]) -template <typename T, class Context> -CAFFE2_API void -ElemwiseMax(const int N, const T* x, const T* y, T* z, Context* context); - // Elemwise maximum of vector x and scalar alpha. y[i] = max(x[i], alpha) template <typename T, class Context> CAFFE2_API void @@ -621,7 +611,6 @@ CAFFE2_API void NHWC2NCHW( T* Y, Context* context); - } // namespace math } // namespace caffe2 |