ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::cker::bias_op Namespace Reference

Namespaces

namespace  functor
 

Typedefs

using Device = Eigen::ThreadPoolDevice
 

Functions

template<typename T >
void biasHelper (const Shape &bias_shape, const T *bias_data, const Shape &input_shape, T *input_data, T activation_min, T activation_max)
 

Typedef Documentation

◆ Device

using nnfw::cker::bias_op::Device = typedef Eigen::ThreadPoolDevice

Definition at line 94 of file bias_op.h.

Function Documentation

◆ biasHelper()

template<typename T >
void nnfw::cker::bias_op::biasHelper ( const Shape bias_shape,
const T *  bias_data,
const Shape input_shape,
T *  input_data,
activation_min,
activation_max 
)

Definition at line 97 of file bias_op.h.

99{
100 [[maybe_unused]] int channel_dim = input_shape.DimensionsCount() - 1;
101
102 assert(input_shape.Dims(channel_dim) == bias_shape.Dims(0));
103 assert(input_data);
104 assert(bias_data);
105
106 Tensor bias{bias_shape, const_cast<T *>(bias_data)};
107 Tensor input{input_shape, input_data};
108
109 functor::Bias<Device, T> functor;
110 const Eigen::ThreadPoolDevice &d = *eigen_support::GetThreadPoolDevice();
111 functor(d, static_cast<const Tensor &>(input).flat<T>(),
112 static_cast<const Tensor &>(bias).flat<T>(), input.flat<T>(), activation_min,
113 activation_max);
114}
int32_t DimensionsCount() const
Definition Shape.h:91
int32_t Dims(int i) const
Definition Shape.h:92

References nnfw::cker::Shape::DimensionsCount(), nnfw::cker::Shape::Dims(), and nnfw::cker::eigen_support::GetThreadPoolDevice().