Add abs functions

This commit is contained in:
zhoushunjie
2022-11-24 04:02:00 +00:00
parent a14c55069f
commit 12af6b4464
4 changed files with 34 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ DEFINE_ACTIVATION_KERNEL(Sqrt, SqrtFunctor)
DEFINE_ACTIVATION_KERNEL(Log, LogFunctor)
DEFINE_ACTIVATION_KERNEL(Round, RoundFunctor)
DEFINE_ACTIVATION_KERNEL(Exp, ExpFunctor)
DEFINE_ACTIVATION_KERNEL(Abs, AbsFunctor)
void Sqrt(const FDTensor& x, FDTensor* out) {
FD_VISIT_FLOAT_TYPES(x.dtype, "SqrtKernel",
@@ -60,5 +61,10 @@ void Exp(const FDTensor& x, FDTensor* out) {
([&] { ExpKernel<data_t>(x, out); }));
}
void Abs(const FDTensor& x, FDTensor* out) {
FD_VISIT_FLOAT_TYPES(x.dtype, "AbsKernel",
([&] { AbsKernel<data_t>(x, out); }));
}
} // namespace function
} // namespace fastdeploy