ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TransposeConv.cpp File Reference
#include <nonius/nonius.h++>
#include <arm_compute/core/Types.h>
#include <arm_compute/runtime/CL/CLScheduler.h>
#include <arm_compute/runtime/CL/CLFunctions.h>
#include <arm_compute/runtime/CL/CLFunctionsEx.h>
#include <cstdint>
#include <cassert>
#include <stdexcept>
#include "acl_common/Utils.h"

Go to the source code of this file.

Macros

#define NONIUS_LOCAL_BENCHMARK(name, ...)
 

Functions

 NONIUS_PARAM (BATCH, 1)
 
 NONIUS_PARAM (IFM_C, 3)
 
 NONIUS_PARAM (IFM_H, 244)
 
 NONIUS_PARAM (IFM_W, 244)
 
 NONIUS_PARAM (OFM_C, 3)
 
 NONIUS_PARAM (OFM_H, 244)
 
 NONIUS_PARAM (OFM_W, 244)
 
 NONIUS_PARAM (KER_H, 3)
 
 NONIUS_PARAM (KER_W, 3)
 
 NONIUS_PARAM (STRIDE_H, 1)
 
 NONIUS_PARAM (STRIDE_W, 1)
 
 NONIUS_LOCAL_BENCHMARK ("CLDeconvolutionLayer_NCHW", [](nonius::chronometer meter) { CLDeconvolutionLayer deconv;Configuration p{meter};CLTensor src_tensor{};CLTensor dst_tensor{};CLTensor ker_tensor{};src_tensor.allocator() ->init(p.src_info< NCHW >());dst_tensor.allocator() ->init(p.dst_info< NCHW >());ker_tensor.allocator() ->init(p.ker_info< NCHW >());try { check(deconv.validate(src_tensor.info(), ker_tensor.info(), nullptr, dst_tensor.info(), p.deconv_info, p.inner_border_right, p.inner_border_top));} catch(...) { meter.measure([&](int) { volatile int x=0;return x;});return;} deconv.configure(&src_tensor, &ker_tensor, nullptr, &dst_tensor, p.deconv_info, p.inner_border_right, p.inner_border_top);src_tensor.allocator() ->allocate();ker_tensor.allocator() ->allocate();dst_tensor.allocator() ->allocate();meter.measure([&](int) { deconv.run();CLScheduler::get().sync();});}) NONIUS_LOCAL_BENCHMARK("CLDeconvolutionLayer_NHWC"
 
src_tensor allocator () -> init(p.src_info< NHWC >())
 
 catch (...)
 
meter measure ([&](int) { deconv.run();CLScheduler::get().sync();})
 
 NONIUS_LOCAL_BENCHMARK ("CLDeconvolutionLayerEx_NCHW", [](nonius::chronometer meter) { CLDeconvolutionLayerEx deconv;Configuration p{meter};CLTensor src_tensor{};CLTensor dst_tensor{};CLTensor ker_tensor{};src_tensor.allocator() ->init(p.src_info< NCHW >());dst_tensor.allocator() ->init(p.dst_info< NCHW >());ker_tensor.allocator() ->init(p.ker_info< NCHW >());try { check(deconv.validate(src_tensor.info(), ker_tensor.info(), nullptr, dst_tensor.info(), p.deconv_info, p.inner_border_right, p.inner_border_top));} catch(...) { meter.measure([&](int) { volatile int x=0;return x;});return;} deconv.configure(&src_tensor, &ker_tensor, nullptr, &dst_tensor, p.deconv_info, p.inner_border_right, p.inner_border_top);src_tensor.allocator() ->allocate();ker_tensor.allocator() ->allocate();dst_tensor.allocator() ->allocate();meter.measure([&](int) { deconv.run();CLScheduler::get().sync();});}) NONIUS_LOCAL_BENCHMARK("CLDeconvolutionLayerEx_NHWC"
 
nonius::benchmark_registry & benchmark_functions (void)
 

Variables

nonius::chronometer meter
 
Configuration p {meter}
 
CLTensor src_tensor {}
 
CLTensor dst_tensor {}
 
CLTensor ker_tensor {}
 
 try
 

Macro Definition Documentation

◆ NONIUS_LOCAL_BENCHMARK

#define NONIUS_LOCAL_BENCHMARK (   name,
  ... 
)
Value:
namespace \
{ \
static ::nonius::benchmark_registrar \
NONIUS_DETAIL_UNIQUE_NAME(benchmark_registrar)(local_benchmark_registry(), name, __VA_ARGS__); \
}

Definition at line 210 of file TransposeConv.cpp.

212 { \
213 static ::nonius::benchmark_registrar \
214 NONIUS_DETAIL_UNIQUE_NAME(benchmark_registrar)(local_benchmark_registry(), name, __VA_ARGS__); \
215 }

Function Documentation

◆ allocator()

src_tensor allocator ( ) -> init(p.src_info< NHWC >())

◆ benchmark_functions()

nonius::benchmark_registry & benchmark_functions ( void  )

Definition at line 389 of file TransposeConv.cpp.

390{
391 return local_benchmark_registry();
392}

◆ catch()

catch (   ...)

Definition at line 279 of file TransposeConv.cpp.

280 {
281 meter.measure([&](int) {
282 // DO NOTHING
283 volatile int x = 0;
284 return x;
285 });
286 return;
287 }
nonius::chronometer meter

References meter.

◆ measure()

meter measure ( [&] (int) { deconv.run();CLScheduler::get().sync();}  )

◆ NONIUS_LOCAL_BENCHMARK() [1/2]

NONIUS_LOCAL_BENCHMARK ( "CLDeconvolutionLayer_NCHW"  ,
[] (nonius::chronometer meter) { CLDeconvolutionLayer deconv;Configuration p{meter};CLTensor src_tensor{};CLTensor dst_tensor{};CLTensor ker_tensor{};src_tensor.allocator() ->init(p.src_info< NCHW >());dst_tensor.allocator() ->init(p.dst_info< NCHW >());ker_tensor.allocator() ->init(p.ker_info< NCHW >());try { check(deconv.validate(src_tensor.info(), ker_tensor.info(), nullptr, dst_tensor.info(), p.deconv_info, p.inner_border_right, p.inner_border_top));} catch(...) { meter.measure([&](int) { volatile int x=0;return x;});return;} deconv.configure(&src_tensor, &ker_tensor, nullptr, &dst_tensor, p.deconv_info, p.inner_border_right, p.inner_border_top);src_tensor.allocator() ->allocate();ker_tensor.allocator() ->allocate();dst_tensor.allocator() ->allocate();meter.measure([&](int) { deconv.run();CLScheduler::get().sync();});}   
)

References dst_tensor, ker_tensor, meter, p, and src_tensor.

◆ NONIUS_LOCAL_BENCHMARK() [2/2]

NONIUS_LOCAL_BENCHMARK ( "CLDeconvolutionLayerEx_NCHW"  ,
[] (nonius::chronometer meter) { CLDeconvolutionLayerEx deconv;Configuration p{meter};CLTensor src_tensor{};CLTensor dst_tensor{};CLTensor ker_tensor{};src_tensor.allocator() ->init(p.src_info< NCHW >());dst_tensor.allocator() ->init(p.dst_info< NCHW >());ker_tensor.allocator() ->init(p.ker_info< NCHW >());try { check(deconv.validate(src_tensor.info(), ker_tensor.info(), nullptr, dst_tensor.info(), p.deconv_info, p.inner_border_right, p.inner_border_top));} catch(...) { meter.measure([&](int) { volatile int x=0;return x;});return;} deconv.configure(&src_tensor, &ker_tensor, nullptr, &dst_tensor, p.deconv_info, p.inner_border_right, p.inner_border_top);src_tensor.allocator() ->allocate();ker_tensor.allocator() ->allocate();dst_tensor.allocator() ->allocate();meter.measure([&](int) { deconv.run();CLScheduler::get().sync();});}   
)

References dst_tensor, ker_tensor, meter, p, and src_tensor.

◆ NONIUS_PARAM() [1/11]

NONIUS_PARAM ( BATCH  ,
 
)

◆ NONIUS_PARAM() [2/11]

NONIUS_PARAM ( IFM_C  ,
 
)

◆ NONIUS_PARAM() [3/11]

NONIUS_PARAM ( IFM_H  ,
244   
)

◆ NONIUS_PARAM() [4/11]

NONIUS_PARAM ( IFM_W  ,
244   
)

◆ NONIUS_PARAM() [5/11]

NONIUS_PARAM ( KER_H  ,
 
)

◆ NONIUS_PARAM() [6/11]

NONIUS_PARAM ( KER_W  ,
 
)

◆ NONIUS_PARAM() [7/11]

NONIUS_PARAM ( OFM_C  ,
 
)

◆ NONIUS_PARAM() [8/11]

NONIUS_PARAM ( OFM_H  ,
244   
)

◆ NONIUS_PARAM() [9/11]

NONIUS_PARAM ( OFM_W  ,
244   
)

◆ NONIUS_PARAM() [10/11]

NONIUS_PARAM ( STRIDE_H  ,
 
)

◆ NONIUS_PARAM() [11/11]

NONIUS_PARAM ( STRIDE_W  ,
 
)

Variable Documentation

◆ dst_tensor

CLTensor dst_tensor {}

Definition at line 267 of file TransposeConv.cpp.

267{};

Referenced by NONIUS_LOCAL_BENCHMARK(), and NONIUS_LOCAL_BENCHMARK().

◆ ker_tensor

CLTensor ker_tensor {}

Definition at line 268 of file TransposeConv.cpp.

268{};

Referenced by NONIUS_LOCAL_BENCHMARK(), and NONIUS_LOCAL_BENCHMARK().

◆ meter

nonius::chronometer meter
Initial value:
{
CLDeconvolutionLayer deconv

Definition at line 260 of file TransposeConv.cpp.

Referenced by catch(), NONIUS_LOCAL_BENCHMARK(), and NONIUS_LOCAL_BENCHMARK().

◆ p

Configuration p {meter}

Definition at line 264 of file TransposeConv.cpp.

264{meter};

Referenced by NONIUS_LOCAL_BENCHMARK(), and NONIUS_LOCAL_BENCHMARK().

◆ src_tensor

deconv configure& src_tensor {}

Definition at line 266 of file TransposeConv.cpp.

266{};

Referenced by NONIUS_LOCAL_BENCHMARK(), and NONIUS_LOCAL_BENCHMARK().

◆ try

try
Initial value:
{
check(deconv.validate(src_tensor.info(), ker_tensor.info(), nullptr, dst_tensor.info(),
p.deconv_info, p.inner_border_right, p.inner_border_top))
CLTensor dst_tensor
CLTensor src_tensor
Configuration p
CLTensor ker_tensor

Definition at line 274 of file TransposeConv.cpp.