ONE - On-device Neural Engine
Loading...
Searching...
No Matches
mir_interpreter::HardSwishImpl< T > Struct Template Reference

Static Public Member Functions

static void run (const mir::TensorVariant &input, mir::TensorVariant &result)
 

Detailed Description

template<typename T>
struct mir_interpreter::HardSwishImpl< T >

Definition at line 23 of file HardSwish.cpp.

Member Function Documentation

◆ run()

template<typename T >
void mir_interpreter::HardSwishImpl< T >::run ( const mir::TensorVariant input,
mir::TensorVariant result 
)
static

Definition at line 29 of file HardSwish.cpp.

30{
31 auto output_data = reinterpret_cast<T *>(result.atOffset(0));
32 auto input_data = reinterpret_cast<T *>(input.atOffset(0));
33 auto in_end = input_data + input.getShape().numElements();
34 for (; input_data < in_end; input_data++, output_data++)
35 {
36 const auto in = *input_data;
37 *output_data = in * std::min<T>(6.f, std::max<T>(0.f, in + 3.f)) / 6.f;
38 }
39}
result
Definition infer.py:103
list input_data
Definition infer.py:29

Referenced by package.infer.session::inference().


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