Compute Library
 22.11
NodeExecutionMethodMutator Class Referencefinal

Mutation pass to fall-back to default execution method. More...

#include <NodeExecutionMethodMutator.h>

Collaboration diagram for NodeExecutionMethodMutator:
[legend]

Public Member Functions

virtual void mutate (Graph &g) override
 Walk the graph and perform a specific mutation. More...
 
MutationType type () const override
 Returns mutation type. More...
 
const char * name () override
 Returns mutator name. More...
 
- Public Member Functions inherited from IGraphMutator
virtual ~IGraphMutator ()=default
 Virtual Destructor. More...
 

Additional Inherited Members

- Public Types inherited from IGraphMutator
enum  MutationType { IR, Backend }
 Mutation type. More...
 

Detailed Description

Mutation pass to fall-back to default execution method.

Note
This operates on nodes that support multiple execution methods (e.g. ConvolutionLayerNode) and in case the requested execution method is not supported for a given configuration. Thus this is a fall-back mechanism to ensure graph execution.

Definition at line 39 of file NodeExecutionMethodMutator.h.

Member Function Documentation

◆ mutate()

void mutate ( Graph g)
overridevirtual

Walk the graph and perform a specific mutation.

Parameters
[in,out]gGraph to walk and mutate

Implements IGraphMutator.

Definition at line 81 of file NodeExecutionMethodMutator.cpp.

References ARM_COMPUTE_LOG_GRAPH_INFO, arm_compute::graph::ConvolutionLayer, arm_compute::graph::Default, arm_compute::graph::DepthwiseConvolutionLayer, INode::id(), arm_compute::test::validation::n, and INode::name().

82 {
83  // Convolution Layer
84  set_default_on_invalid_method(g, NodeType::ConvolutionLayer, [](INode * n)
85  {
86  ARM_COMPUTE_LOG_GRAPH_INFO("Switched ConvolutionLayer method of node with ID : "
87  << n->id() << " and Name: " << n->name() << std::endl);
88  auto *casted_node = arm_compute::utils::cast::polymorphic_downcast<ConvolutionLayerNode *>(n);
89  casted_node->set_convolution_method(ConvolutionMethod::Default);
90  });
91 
92  // Depthwise Convolution Layer
93  set_default_on_invalid_method(g, NodeType::DepthwiseConvolutionLayer, [](INode * n)
94  {
95  ARM_COMPUTE_LOG_GRAPH_INFO("Switched Depthwise ConvolutionLayer method of node with ID : "
96  << n->id() << " and Name: " << n->name() << std::endl);
97  auto *casted_node = arm_compute::utils::cast::polymorphic_downcast<DepthwiseConvolutionLayerNode *>(n);
98  casted_node->set_depthwise_convolution_method(DepthwiseConvolutionMethod::Default);
99  });
100 }
#define ARM_COMPUTE_LOG_GRAPH_INFO(x)
Definition: Logger.h:54
Default approach using internal heuristics.
Default approach using internal heuristics.

◆ name()

const char * name ( )
overridevirtual

Returns mutator name.

Returns
Mutator name

Implements IGraphMutator.

Definition at line 71 of file NodeExecutionMethodMutator.cpp.

72 {
73  return "NodeExecutionMethodMutator";
74 }

◆ type()

IGraphMutator::MutationType type ( ) const
overridevirtual

Returns mutation type.

Returns
Mutation type enumeration

Implements IGraphMutator.

Definition at line 76 of file NodeExecutionMethodMutator.cpp.

References IGraphMutator::Backend.


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