df_func.h 5.5 KB
Newer Older
X
Xinqi Li 已提交
1 2 3
#ifndef ONEFLOW_CORE_AUTO_PLACEMNENT_DF_FUNC_H_
#define ONEFLOW_CORE_AUTO_PLACEMNENT_DF_FUNC_H_

X
Xinqi Li 已提交
4
#include "oneflow/core/auto_placement/tensor.h"
X
Xinqi Li 已提交
5
#include "oneflow/core/common/preprocessor.h"
X
Xinqi Li 已提交
6 7 8

namespace oneflow {

X
Xinqi Li 已提交
9
namespace df {
X
Xinqi Li 已提交
10

X
Xinqi Li 已提交
11 12
Tensor _Update(const std::string& caller, Tensor* var, double lr);
#define Update(...) _Update(__LOC__, __VA_ARGS__)
13

X
Xinqi Li 已提交
14 15 16
Tensor _DiffWatch(const std::string& caller, const Tensor& input,
                  const std::function<void(const Buffer& out_diff)>& Handler);
#define DiffWatch(...) _DiffWatch(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
17

X
Xinqi Li 已提交
18
#define __LOC__ __FILE__ ":" OF_PP_STRINGIZE(__LINE__)
X
Xinqi Li 已提交
19

X
Xinqi Li 已提交
20 21 22
Tensor _ColIndexReduce(const std::string& caller, const Tensor& input,
                       const std::vector<std::vector<int64_t>>& reduce_indexes);
#define ColIndexReduce(...) _ColIndexReduce(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
23

X
Xinqi Li 已提交
24 25 26
Tensor _IndexReduce(const std::string& caller, const Tensor& input,
                    const std::vector<std::vector<int64_t>>& reduce_indexes);
#define IndexReduce(...) _IndexReduce(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
27

X
Xinqi Li 已提交
28 29 30
std::vector<Tensor> _Clone(const std::string& caller, const Tensor& input,
                           size_t n);
#define Clone(...) _Clone(__LOC__, __VA_ARGS__)
31

X
Xinqi Li 已提交
32 33 34
Tensor _Reshape(const std::string& caller, const Tensor& input,
                const Shape& shape);
#define Reshape(...) _Reshape(__LOC__, __VA_ARGS__)
35

X
Xinqi Li 已提交
36 37
Tensor _Minus(const std::string& caller, const Tensor& input);
#define Minus(...) _Minus(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
38

X
Xinqi Li 已提交
39 40 41 42 43 44
Tensor _Abs(const std::string& caller, const Tensor& input);
#define Abs(...) _Abs(__LOC__, __VA_ARGS__)

Tensor _Exp(const std::string& caller, const Tensor& input);
#define Exp(...) _Exp(__LOC__, __VA_ARGS__)

X
Xinqi Li 已提交
45 46 47
Tensor _Log(const std::string& caller, const Tensor& input);
#define Log(...) _Log(__LOC__, __VA_ARGS__)

X
Xinqi Li 已提交
48 49
Tensor _Tanh(const std::string& caller, const Tensor& input);
#define Tanh(...) _Tanh(__LOC__, __VA_ARGS__)
50

X
Xinqi Li 已提交
51
Tensor Tee(const Tensor& input, Tensor* out);
X
Xinqi Li 已提交
52

X
Xinqi Li 已提交
53 54
Tensor _Add(const std::string& caller, const Tensor& a, const Tensor& b);
#define ADD(...) _Add(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
55

X
Xinqi Li 已提交
56 57
Tensor _Sub(const std::string& caller, const Tensor& a, const Tensor& b);
#define Sub(...) _Sub(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
58

X
Xinqi Li 已提交
59 60 61
Tensor _ElemWiseMul(const std::string& caller, const Tensor& a,
                    const Tensor& b);
#define ElemWiseMul(...) _ElemWiseMul(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
62

X
Xinqi Li 已提交
63 64 65
Tensor _ElemWiseDiv(const std::string& caller, const Tensor& a,
                    const Tensor& b);
#define ElemWiseDiv(...) _ElemWiseDiv(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
66

X
Xinqi Li 已提交
67 68
Tensor _Mul(const std::string& caller, const Tensor& a, const Tensor& b);
#define Mul(...) _Mul(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
69

X
Xinqi Li 已提交
70 71
Tensor _Reciprocal(const std::string& caller, const Tensor& input);
#define Reciprocal(...) _Reciprocal(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
72

X
Xinqi Li 已提交
73 74
Tensor _Max(const std::string& caller, const Tensor& a, const Tensor& b);
#define Max(...) _Max(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
75

X
Xinqi Li 已提交
76 77
Tensor _Min(const std::string& caller, const Tensor& a, const Tensor& b);
#define Min(...) _Min(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
78

X
Xinqi Li 已提交
79 80
Tensor _MaxElem(const std::string& caller, const Tensor& a);
#define MaxElem(...) _MaxElem(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
81

X
Xinqi Li 已提交
82 83
Tensor _Relu(const std::string& caller, const Tensor& input);
#define Relu(...) _Relu(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
84

X
Xinqi Li 已提交
85 86
Tensor _MinElem(const std::string& caller, const Tensor& a);
#define MinElem(...) _MinElem(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
87

X
Xinqi Li 已提交
88 89
Tensor _Sum(const std::string& caller, const Tensor& a);
#define Sum(...) _Sum(__LOC__, __VA_ARGS__)
90

X
Xinqi Li 已提交
91 92
Tensor _Avg(const std::string& caller, const Tensor& a);
#define Avg(...) _Avg(__LOC__, __VA_ARGS__)
93

X
Xinqi Li 已提交
94 95
Tensor _Variance(const std::string& caller, const Tensor& a);
#define Variance(...) _Variance(__LOC__, __VA_ARGS__)
96

X
Xinqi Li 已提交
97 98
Tensor _StandardDeviation(const std::string& caller, const Tensor& a);
#define StandardDeviation(...) _StandardDeviation(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
99

X
Xinqi Li 已提交
100 101
Tensor _AvgAbsDeviation(const std::string& caller, const Tensor& a);
#define AvgAbsDeviation(...) _AvgAbsDeviation(__LOC__, __VA_ARGS__)
102

X
Xinqi Li 已提交
103 104
Tensor _DoubleVariance(const std::string& caller, const Tensor& input);
#define DoubleVariance(...) _DoubleVariance(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
105

X
Xinqi Li 已提交
106 107
Tensor _DoubleAvgAbsDeviation(const std::string& caller, const Tensor& input);
#define DoubleAvgAbsDeviation(...) _DoubleAvgAbsDeviation(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
108

X
backup  
Xinqi Li 已提交
109 110 111
Tensor _GeMean(const std::string& caller, const Tensor& input);
#define GeMean(...) _GeMean(__LOC__, __VA_ARGS__)

X
Xinqi Li 已提交
112 113
Tensor _Square(const std::string& caller, const Tensor& input);
#define Square(...) _Square(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
114

X
Xinqi Li 已提交
115 116
Tensor _Sqrt(const std::string& caller, const Tensor& input);
#define Sqrt(...) _Sqrt(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
117

X
Xinqi Li 已提交
118 119
Tensor _MatrixRowSum(const std::string& caller, const Tensor& input);
#define MatrixRowSum(...) _MatrixRowSum(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
120

X
Xinqi Li 已提交
121 122
Tensor _MatrixColSum(const std::string& caller, const Tensor& input);
#define MatrixColSum(...) _MatrixColSum(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
123

X
Xinqi Li 已提交
124 125
Tensor _MatrixColMax(const std::string& caller, const Tensor& input);
#define MatrixColMax(...) _MatrixColMax(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
126

X
Xinqi Li 已提交
127 128 129
Tensor _TensorProduct(const std::string& caller, const Tensor& a,
                      const Tensor& b);
#define TensorProduct(...) _TensorProduct(__LOC__, __VA_ARGS__)
130

X
Xinqi Li 已提交
131 132
Tensor _FixedExpectation(const std::string& caller, const Tensor& a, double e);
#define FixedExpectation(...) _FixedExpectation(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
133

X
Xinqi Li 已提交
134 135
Tensor _FixedMaxVal(const std::string& caller, const Tensor& a, double e);
#define FixedMaxVal(...) _FixedMaxVal(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
136

X
Xinqi Li 已提交
137 138
Tensor _Backward(const std::string& caller, const Tensor& loss);
#define BackwardRun(...) _Backward(__LOC__, __VA_ARGS__)
X
Xinqi Li 已提交
139 140

}  // namespace df
X
Xinqi Li 已提交
141 142 143 144

}  // namespace oneflow

#endif  // ONEFLOW_CORE_AUTO_PLACEMNENT_DF_FUNC_H_