ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::cker::bias_op::functor::Bias< Device, T > Struct Template Reference

#include <bias_op.h>

Public Member Functions

void operator() (const Device &d, typename TTypes< T >::ConstFlat input, typename TTypes< T >::ConstVec bias, typename TTypes< T >::Flat output, T activation_min, T activation_max)
 

Detailed Description

template<typename Device, typename T>
struct nnfw::cker::bias_op::functor::Bias< Device, T >

Definition at line 59 of file bias_op.h.

Member Function Documentation

◆ operator()()

template<typename Device , typename T >
void nnfw::cker::bias_op::functor::Bias< Device, T >::operator() ( const Device d,
typename TTypes< T >::ConstFlat  input,
typename TTypes< T >::ConstVec  bias,
typename TTypes< T >::Flat  output,
activation_min,
activation_max 
)
inline

Definition at line 62 of file bias_op.h.

65 {
66 const Eigen::Index rest_size = input.size() / bias.dimension(0);
67 Eigen::DSizes<Eigen::Index, 1> bcast(rest_size);
68 MaybeWith32BitIndexing<Device>(
69 [&](auto input32, auto bias32, typename TTypes<T>::Flat output32, const auto &bcast32,
70 T activation_min, T activation_max) {
71 output32.device(d) =
72 (input32 + bias32.broadcast(bcast32))
73 .template cwiseMax<Eigen::PropagateNaN>(static_cast<T>(activation_min))
74 .template cwiseMin<Eigen::PropagateNaN>(static_cast<T>(activation_max));
75 },
76 input, bias, output, bcast, activation_min, activation_max);
77 }
Eigen::TensorMap< Eigen::Tensor< T, 1, Eigen::RowMajor, IndexType >, Eigen::Aligned > Flat
Definition Tensor.h:61

The documentation for this struct was generated from the following file: