10#ifndef EIGEN_NEON_UNARY_FUNCTORS_H
11#define EIGEN_NEON_UNARY_FUNCTORS_H
14#include "../../InternalHeaderCheck.h"
20#if EIGEN_ARCH_ARM64 && EIGEN_HAS_ARM64_FP16
25struct scalar_logistic_op<Eigen::half> {
26 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::half operator()(
const Eigen::half& x)
const {
28 const scalar_logistic_op<float> float_op;
29 return Eigen::half(float_op(
float(x)));
32 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::half packetOp(
const Eigen::half& x)
const {
return this->operator()(x); }
34 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet4hf packetOp(
const Packet4hf& x)
const {
35 const scalar_logistic_op<float> float_op;
36 return vcvt_f16_f32(float_op.packetOp(vcvt_f32_f16(x)));
39 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet8hf packetOp(
const Packet8hf& x)
const {
40 const scalar_logistic_op<float> float_op;
41 return vcombine_f16(vcvt_f16_f32(float_op.packetOp(vcvt_f32_f16(vget_low_f16(x)))),
42 vcvt_f16_f32(float_op.packetOp(vcvt_f32_f16(vget_high_f16(x)))));
47struct functor_traits<scalar_logistic_op<Eigen::half>> {
49 Cost = functor_traits<scalar_logistic_op<float>>::Cost,
50 PacketAccess = functor_traits<scalar_logistic_op<float>>::PacketAccess,