17 #include "fastdeploy/function/eigen.h" 23 template <
typename T>
struct LogFunctor {
24 template <
typename Device,
typename X,
typename Out>
25 void operator()(Device d, X x, Out out)
const {
26 out.device(d) = x.log();
32 template <
typename T>
struct ExpFunctor {
33 template <
typename Device,
typename X,
typename Out>
34 void operator()(Device d, X x, Out out)
const {
35 out.device(d) = x.exp();
40 template <
typename T>
struct RoundFunctor {
41 template <
typename Device,
typename X,
typename Out>
42 void operator()(Device d, X x, Out out)
const {
43 out.device(d) = x.round();
48 template <
typename T>
struct SqrtFunctor {
49 template <
typename Device,
typename X,
typename Out>
50 void operator()(Device d, X x, Out out)
const {
51 out.device(d) = x.sqrt();
56 template <
typename T>
struct AbsFunctor {
57 template <
typename Device,
typename X,
typename Out>
58 void operator()(Device d, X x, Out out)
const {
60 x.unaryExpr([](T v) {
return v >
static_cast<T
>(0) ? v : -v; });
65 template <
typename T>
struct CeilFunctor {
66 template <
typename Device,
typename X,
typename Out>
67 void operator()(Device d, X x, Out out)
const {
68 out.device(d) = x.ceil();
73 template <
typename T>
struct FloorFunctor {
74 template <
typename Device,
typename X,
typename Out>
75 void operator()(Device d, X x, Out out)
const {
76 out.device(d) = x.floor();
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16