Compute Library
 23.11
GraphValidateExample< LayerT, OptionsT, VerifyAccessorT > Class Template Referenceabstract

#include <graph_validate_utils.h>

Collaboration diagram for GraphValidateExample< LayerT, OptionsT, VerifyAccessorT >:
[legend]

Public Member Functions

 GraphValidateExample (std::string name)
 
virtual LayerT GraphFunctionLayer (ExampleParams &params)=0
 
bool do_setup (int argc, char **argv) override
 Setup the example. More...
 
void do_run () override
 Run the example. More...
 
void do_teardown () override
 Teardown the example. More...
 
- Public Member Functions inherited from ValidateExample
virtual void do_validate ()
 Run reference implementation and validate against the target output. More...
 
virtual void print_parameters (test::framework::Printer &printer)
 Print the example parameters. More...
 
virtual ~ValidateExample ()=default
 Default destructor. More...
 

Data Fields

arm_compute::graph::frontend::Stream graph
 

Detailed Description

template<typename LayerT, typename OptionsT, template< typename D > class VerifyAccessorT>
class arm_compute::utils::GraphValidateExample< LayerT, OptionsT, VerifyAccessorT >

Definition at line 614 of file graph_validate_utils.h.

Constructor & Destructor Documentation

◆ GraphValidateExample()

GraphValidateExample ( std::string  name)
inline

Definition at line 617 of file graph_validate_utils.h.

618  : graph(0, name)
619  {
620  }

Member Function Documentation

◆ do_run()

void do_run ( )
inlineoverridevirtual

Run the example.

Reimplemented from ValidateExample.

Definition at line 667 of file graph_validate_utils.h.

668  {
669  graph.run();
670  }

◆ do_setup()

bool do_setup ( int  argc,
char **  argv 
)
inlineoverridevirtual

Setup the example.

Parameters
[in]argcArgument count.
[in]argvArgument values.

Reimplemented from ValidateExample.

Definition at line 624 of file graph_validate_utils.h.

625  {
626  CommandLineParser parser;
627 
628  OptionsT Options(parser);
629 
630  parser.parse(argc, argv);
631 
632  ExampleParams params;
633 
634  Options.consume_common_parameters(params);
635  Options.consume_parameters(params);
636 
637  if(params.common_params.help)
638  {
639  parser.print_help(argv[0]);
640  return false;
641  }
642 
643  Options.print_parameters(std::cout, params);
644  // Create input descriptor
645  const TensorShape input_shape = arm_compute::graph_utils::permute_shape(TensorShape(params.input.width, params.input.height, params.input.fm, params.input.batch),
646  DataLayout::NCHW, params.data_layout);
647  arm_compute::graph::TensorDescriptor input_descriptor = arm_compute::graph::TensorDescriptor(input_shape, params.data_type, params.input.quant_info, params.data_layout);
648 
649  const PixelValue lower = PixelValue(params.input.range_low, params.data_type, params.input.quant_info);
650  const PixelValue upper = PixelValue(params.input.range_high, params.data_type, params.input.quant_info);
651 
652  graph << params.common_params.target
653  << params.convolution_method
654  << params.depth_convolution_method
655  << arm_compute::graph::frontend::InputLayer(input_descriptor, get_accessor(params.input, lower, upper, 0))
656  << GraphFunctionLayer(params)
657  << arm_compute::graph::frontend::OutputLayer(get_verify_accessor<VerifyAccessorT>(params));
658 
660  config.num_threads = params.common_params.threads;
661 
662  graph.finalize(params.common_params.target, config);
663 
664  return true;
665  }

◆ do_teardown()

void do_teardown ( )
inlineoverridevirtual

Teardown the example.

Reimplemented from ValidateExample.

Definition at line 672 of file graph_validate_utils.h.

673  {
674  }

◆ GraphFunctionLayer()

Field Documentation

◆ graph


The documentation for this class was generated from the following file:
arm_compute::DataLayout::NCHW
@ NCHW
Num samples, channels, height, width.
arm_compute::graph::GraphConfig::num_threads
int num_threads
Number of threads to use (thread capable backends), if 0 the backend will auto-initialize,...
Definition: Types.h:96
arm_compute::utils::get_accessor
std::unique_ptr< graph::ITensorAccessor > get_accessor(const TensorParams &tensor, PixelValue lower, PixelValue upper, const std::random_device::result_type seed=0)
Generates appropriate accessor according to the specified graph parameters.
Definition: graph_validate_utils.h:332
arm_compute::graph::frontend::InputLayer
Input Layer.
Definition: Layers.h:44
GemmTuner.parser
parser
Definition: GemmTuner.py:640
arm_compute::graph::GraphConfig
Graph configuration structure.
Definition: Types.h:87
arm_compute::utils::GraphValidateExample::GraphFunctionLayer
virtual LayerT GraphFunctionLayer(ExampleParams &params)=0
arm_compute::graph_utils::permute_shape
TensorShape permute_shape(TensorShape tensor_shape, DataLayout in_data_layout, DataLayout out_data_layout)
Permutes a given tensor shape given the input and output data layout.
Definition: GraphUtils.h:673
name
const char * name
Definition: NEBatchNormalizationLayerKernel.cpp:66
arm_compute::test::validation::input_shape
TensorShape input_shape
Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros we use to check the validity of given a...
Definition: LSTMLayerQuantized.cpp:466
arm_compute::graph::TensorDescriptor
Tensor metadata class.
Definition: TensorDescriptor.h:38
arm_compute::graph::frontend::OutputLayer
Output Layer.
Definition: Layers.h:92
arm_compute::graph::frontend::Stream::run
void run()
Executes the stream.
Definition: Stream.cpp:46
arm_compute::utils::GraphValidateExample::graph
arm_compute::graph::frontend::Stream graph
Definition: graph_validate_utils.h:676
arm_compute::graph::frontend::Stream::finalize
void finalize(Target target, const GraphConfig &config)
Finalizes the stream for an execution target.
Definition: Stream.cpp:39