Add maximum functions

This commit is contained in:
zhoushunjie
2022-11-23 05:14:30 +00:00
parent de98163efa
commit 5ce0fd29f8
4 changed files with 79 additions and 0 deletions
+13
View File
@@ -71,5 +71,18 @@ FDTensor operator/(const FDTensor& x, const FDTensor& y) {
return out;
}
template <typename T> struct MaximumRawKernel {
void operator()(const FDTensor& x, const FDTensor& y, int axis,
FDTensor* out) {
ElementwiseCompute<MaximumFunctor<T>, T>(x, y, axis, MaximumFunctor<T>(),
out);
}
};
void Maximum(const FDTensor& x, const FDTensor& y, FDTensor* out) {
FD_VISIT_ALL_TYPES(x.dtype, "MaximumRawKernel",
([&] { MaximumRawKernel<data_t>()(x, y, -1, out); }));
}
} // namespace function
} // namespace fastdeploy