Compute Library
 22.08
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 628 of file graph_validate_utils.h.

Constructor & Destructor Documentation

◆ GraphValidateExample()

GraphValidateExample ( std::string  name)
inline

Definition at line 631 of file graph_validate_utils.h.

632  : graph(0, name)
633  {
634  }
const char * name
arm_compute::graph::frontend::Stream graph

Member Function Documentation

◆ do_run()

void do_run ( )
inlineoverridevirtual

Run the example.

Reimplemented from ValidateExample.

Definition at line 681 of file graph_validate_utils.h.

682  {
683  graph.run();
684  }
void run()
Executes the stream.
Definition: Stream.cpp:47
arm_compute::graph::frontend::Stream graph

◆ 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 638 of file graph_validate_utils.h.

639  {
640  CommandLineParser parser;
641 
642  OptionsT Options(parser);
643 
644  parser.parse(argc, argv);
645 
646  ExampleParams params;
647 
648  Options.consume_common_parameters(params);
649  Options.consume_parameters(params);
650 
651  if(params.common_params.help)
652  {
653  parser.print_help(argv[0]);
654  return false;
655  }
656 
657  Options.print_parameters(std::cout, params);
658  // Create input descriptor
659  const TensorShape input_shape = arm_compute::graph_utils::permute_shape(TensorShape(params.input.width, params.input.height, params.input.fm, params.input.batch),
660  DataLayout::NCHW, params.data_layout);
661  arm_compute::graph::TensorDescriptor input_descriptor = arm_compute::graph::TensorDescriptor(input_shape, params.data_type, params.input.quant_info, params.data_layout);
662 
663  const PixelValue lower = PixelValue(params.input.range_low, params.data_type, params.input.quant_info);
664  const PixelValue upper = PixelValue(params.input.range_high, params.data_type, params.input.quant_info);
665 
666  graph << params.common_params.target
667  << params.convolution_method
668  << params.depth_convolution_method
669  << arm_compute::graph::frontend::InputLayer(input_descriptor, get_accessor(params.input, lower, upper, 0))
670  << GraphFunctionLayer(params)
671  << arm_compute::graph::frontend::OutputLayer(get_verify_accessor<VerifyAccessorT>(params));
672 
674  config.num_threads = params.common_params.threads;
675 
676  graph.finalize(params.common_params.target, config);
677 
678  return true;
679  }
Graph configuration structure Device target types.
Definition: Types.h:84
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.
const auto input_shape
Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros we use to check the validity of given a...
Num samples, channels, height, width.
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:665
void finalize(Target target, const GraphConfig &config)
Finalizes the stream for an execution target.
Definition: Stream.cpp:40
virtual LayerT GraphFunctionLayer(ExampleParams &params)=0
int num_threads
Number of threads to use (thread capable backends), if 0 the backend will auto-initialize, if -1 the backend will stay as it is.
Definition: Types.h:93
arm_compute::graph::frontend::Stream graph

◆ do_teardown()

void do_teardown ( )
inlineoverridevirtual

Teardown the example.

Reimplemented from ValidateExample.

Definition at line 686 of file graph_validate_utils.h.

687  {
688  }

◆ GraphFunctionLayer()

virtual LayerT GraphFunctionLayer ( ExampleParams params)
pure virtual

Field Documentation

◆ graph


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