ONE - On-device Neural Engine
Loading...
Searching...
No Matches
arm_compute::NEMultiplyScaleFactorKernel Class Reference

#include <NEMuliplyScaleFactorKernel.h>

Collaboration diagram for arm_compute::NEMultiplyScaleFactorKernel:

Public Member Functions

const char * name () const override
 
 NEMultiplyScaleFactorKernel ()
 
 NEMultiplyScaleFactorKernel (const NEMultiplyScaleFactorKernel &)=delete
 
NEMultiplyScaleFactorKerneloperator= (const NEMultiplyScaleFactorKernel &)=delete
 
 NEMultiplyScaleFactorKernel (NEMultiplyScaleFactorKernel &&)=default
 
NEMultiplyScaleFactorKerneloperator= (NEMultiplyScaleFactorKernel &&)=default
 
 ~NEMultiplyScaleFactorKernel ()=default
 
void configure (const ITensor *input, const ITensor *scale_factor, ITensor *output, float multiplier=1.f)
 
void run (const Window &window, const ThreadInfo &info) override
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *scale_factor, const ITensorInfo *output, float multiplier=1.f)
 

Detailed Description

Interface to multiply scale factor kernel.

Definition at line 51 of file NEMuliplyScaleFactorKernel.h.

Constructor & Destructor Documentation

◆ NEMultiplyScaleFactorKernel() [1/3]

NEMultiplyScaleFactorKernel::NEMultiplyScaleFactorKernel ( )

Default constructor

Definition at line 137 of file NEMultiplyScaleFactorKernel.cpp.

138 : _input(nullptr), _scale_factor(nullptr), _output(nullptr), _multiplier(1.f)
139{
140}

◆ NEMultiplyScaleFactorKernel() [2/3]

arm_compute::NEMultiplyScaleFactorKernel::NEMultiplyScaleFactorKernel ( const NEMultiplyScaleFactorKernel )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ NEMultiplyScaleFactorKernel() [3/3]

arm_compute::NEMultiplyScaleFactorKernel::NEMultiplyScaleFactorKernel ( NEMultiplyScaleFactorKernel &&  )
default

Default Move Constructor.

◆ ~NEMultiplyScaleFactorKernel()

arm_compute::NEMultiplyScaleFactorKernel::~NEMultiplyScaleFactorKernel ( )
default

Default destructor

References validate().

Member Function Documentation

◆ configure()

void NEMultiplyScaleFactorKernel::configure ( const ITensor *  input,
const ITensor *  scale_factor,
ITensor *  output,
float  multiplier = 1.f 
)

Set input, output tensors.

Parameters
[in/out]input Source tensor. Data type supported: S32.
[in]scale_factorScale tensor. Data type supported: F16/F32.
[out]outputDestination tensor. Data type supported: Same as scale_factor.

Definition at line 142 of file NEMultiplyScaleFactorKernel.cpp.

144{
145 ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
146 ARM_COMPUTE_ERROR_THROW_ON(
147 validate_arguments(input->info(), scale_factor->info(), output->info()));
148
149 _input = input;
150 _scale_factor = scale_factor;
151 _output = output;
152 _multiplier = multiplier;
153
154 // Configure kernel window
155 Window win_config = calculate_max_window(*input->info(), Steps());
156
157 Coordinates coord;
158 coord.set_num_dimensions(output->info()->num_dimensions());
159 output->info()->set_valid_region(ValidRegion(coord, output->info()->tensor_shape()));
160
161 INEKernel::configure(win_config);
162}

Referenced by arm_compute::NEFullyConnectedHybridLayer::configure().

◆ name()

const char * arm_compute::NEMultiplyScaleFactorKernel::name ( ) const
inlineoverride

Definition at line 54 of file NEMuliplyScaleFactorKernel.h.

54{ return "NEMultiplyScaleFactorKernel"; }

◆ operator=() [1/2]

NEMultiplyScaleFactorKernel & arm_compute::NEMultiplyScaleFactorKernel::operator= ( const NEMultiplyScaleFactorKernel )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

NEMultiplyScaleFactorKernel & arm_compute::NEMultiplyScaleFactorKernel::operator= ( NEMultiplyScaleFactorKernel &&  )
default

Default move assignment operator

◆ run()

void NEMultiplyScaleFactorKernel::run ( const Window &  window,
const ThreadInfo &  info 
)
override

Definition at line 208 of file NEMultiplyScaleFactorKernel.cpp.

209{
210 ARM_COMPUTE_UNUSED(info);
211 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
212 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
213
214 switch (_output->info()->data_type())
215 {
216 case DataType::F32:
217 NEMultiplyScaleFactorKernel::multiply<float>(window);
218 break;
219#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
220 case DataType::F16:
221 NEMultiplyScaleFactorKernel::multiply<float16_t>(window);
222 break;
223#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
224 default:
225 ARM_COMPUTE_ERROR("Unsupported data type.");
226 }
227}
volatile const char info[]

References info.

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

◆ validate()

Status NEMultiplyScaleFactorKernel::validate ( const ITensorInfo *  input,
const ITensorInfo *  scale_factor,
const ITensorInfo *  output,
float  multiplier = 1.f 
)
static

Static function to check if given info will lead to a valid configuration of NEMultiplyScaleFactorKernel

Parameters
[in]inputInput tensor info. Data types supported: S32.
[in]scale_factorScale tensor. Data type supported: F16/F32.
[in]outputOutput tensor info. Data types supported: Same as scale_factor.
Returns
a status

Definition at line 164 of file NEMultiplyScaleFactorKernel.cpp.

167{
168 ARM_COMPUTE_UNUSED(multiplier);
169 ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, scale_factor, output));
170
171 return Status{};
172}

Referenced by arm_compute::NEFullyConnectedHybridLayer::validate(), and ~NEMultiplyScaleFactorKernel().


The documentation for this class was generated from the following files: