Compute Library
 21.02
GEMMInfo Class Reference

GEMM information class. More...

#include <Types.h>

Public Member Functions

 GEMMInfo () noexcept
 Default constructor. More...
 
 GEMMInfo (bool is_a_reshaped, bool is_b_reshaped, bool reshape_b_only_on_first_run, int depth_output_gemm3d=0, bool reinterpret_input_as_3d=false, bool retain_internal_weights=false, GEMMLowpOutputStageInfo gemmlowp_output_stage=GEMMLowpOutputStageInfo(), bool fp_mixed_precision=false, bool broadcast_bias=false, const ActivationLayerInfo &activation_info=ActivationLayerInfo()) noexcept
 Constructor. More...
 
bool is_a_reshaped () const
 Flag which specifies if the matrix A has been reshaped. More...
 
bool is_b_reshaped () const
 Flag which specifies if the matrix B has been reshaped. More...
 
bool reshape_b_only_on_first_run () const
 Flag which specifies if the reshape of matrix B should executed only for the first. More...
 
int depth_output_gemm3d () const
 Depth of the output when GEMM output is reinterpreted as 3D tensor. More...
 
bool reinterpret_input_as_3d () const
 Flag which specifies if the input tensor has to be reinterpreted as 3D. More...
 
bool retain_internal_weights () const
 Flag which specifies if the weights tensor has to be retained from previous run. More...
 
GEMMLowpOutputStageInfo gemmlowp_output_stage () const
 GEMMLowp output stage. More...
 
void set_gemmlowp_output_stage (GEMMLowpOutputStageInfo &output_stage)
 Sets GEMMLowp output stage. More...
 
bool fp_mixed_precision () const
 Flag which specifies if a wider accumulator should be used. More...
 
bool broadcast_bias () const
 Flag which specifies whether to broadcast the shape of the bias tensor. More...
 
bool pretranpose_B () const
 Flag which specifies whether b should be pre-transposed if supported. More...
 
void set_pretranpose_B (bool flag)
 Set pre-transpose b flag. More...
 
ActivationLayerInfo activation_info () const
 Activation layer to apply after the matrix multiplication. More...
 
void set_activation_info (const ActivationLayerInfo &activation_info)
 Set activation layer info. More...
 

Detailed Description

GEMM information class.

This class stores the necessary information to compute GEMM functions

This object also contains the information about how matrix A and matrix B have been reshaped

Definition at line 2003 of file Types.h.

Constructor & Destructor Documentation

◆ GEMMInfo() [1/2]

GEMMInfo ( )
inlinenoexcept

Default constructor.

Definition at line 2007 of file Types.h.

2008  : _is_a_reshaped(false),
2009  _is_b_reshaped(false),
2010  _reshape_b_only_on_first_run(true),
2011  _depth_output_gemm3d(0),
2012  _reinterpret_input_as_3d(false),
2013  _retain_internal_weights(false),
2014  _gemmlowp_output_stage(),
2015  _fp_mixed_precision(false),
2016  _broadcast_bias(false),
2017  _pretranpose_B(true),
2018  _activation_info()
2019  {
2020  }

◆ GEMMInfo() [2/2]

GEMMInfo ( bool  is_a_reshaped,
bool  is_b_reshaped,
bool  reshape_b_only_on_first_run,
int  depth_output_gemm3d = 0,
bool  reinterpret_input_as_3d = false,
bool  retain_internal_weights = false,
GEMMLowpOutputStageInfo  gemmlowp_output_stage = GEMMLowpOutputStageInfo(),
bool  fp_mixed_precision = false,
bool  broadcast_bias = false,
const ActivationLayerInfo activation_info = ActivationLayerInfo() 
)
inlinenoexcept

Constructor.

Parameters
[in]is_a_reshapedTrue if the matrix A has been reshaped
[in]is_b_reshapedTrue if the matrix B has been reshaped
[in]reshape_b_only_on_first_runReshape matrix B only for the first run
[in]depth_output_gemm3d(Optional) Depth (third dimension) of the output tensor to be used with the GEMM3D kernel If 0 the output will not be reinterpreted as 3D. Default 0
[in]reinterpret_input_as_3d(Optional) Reinterpret the input as 3D tensor. (i.e. this flag should be set to true when GEMM is used to perform 1x1 convolutions with the NHWC data layout)
[in]retain_internal_weights(Optional) Retain the weights tensor from previous run
[in]gemmlowp_output_stage(Optional) GEMMLowp Output stage info
[in]fp_mixed_precision(Optional) Use wider accumulators (32 bit instead of 16 for FP16) to improve accuracy.
[in]broadcast_bias(Optional) Broadcast the shape of the bias tensor from a vector to a matrix.
[in]activation_info(Optional) Activation to apply after the matrix multiplication

Definition at line 2036 of file Types.h.

2039  : _is_a_reshaped(is_a_reshaped),
2040  _is_b_reshaped(is_b_reshaped),
2041  _reshape_b_only_on_first_run(reshape_b_only_on_first_run),
2042  _depth_output_gemm3d(depth_output_gemm3d),
2043  _reinterpret_input_as_3d(reinterpret_input_as_3d),
2044  _retain_internal_weights(retain_internal_weights),
2045  _gemmlowp_output_stage(gemmlowp_output_stage),
2046  _fp_mixed_precision(fp_mixed_precision),
2047  _broadcast_bias(broadcast_bias),
2048  _pretranpose_B(reshape_b_only_on_first_run),
2049  _activation_info(activation_info)
2050  {
2051  }
GEMMLowpOutputStageInfo gemmlowp_output_stage() const
GEMMLowp output stage.
Definition: Types.h:2106
bool fp_mixed_precision() const
Flag which specifies if a wider accumulator should be used.
Definition: Types.h:2122
int depth_output_gemm3d() const
Depth of the output when GEMM output is reinterpreted as 3D tensor.
Definition: Types.h:2082
bool retain_internal_weights() const
Flag which specifies if the weights tensor has to be retained from previous run.
Definition: Types.h:2098
bool is_b_reshaped() const
Flag which specifies if the matrix B has been reshaped.
Definition: Types.h:2064
bool reinterpret_input_as_3d() const
Flag which specifies if the input tensor has to be reinterpreted as 3D.
Definition: Types.h:2090
bool broadcast_bias() const
Flag which specifies whether to broadcast the shape of the bias tensor.
Definition: Types.h:2130
bool is_a_reshaped() const
Flag which specifies if the matrix A has been reshaped.
Definition: Types.h:2056
bool reshape_b_only_on_first_run() const
Flag which specifies if the reshape of matrix B should executed only for the first.
Definition: Types.h:2074
ActivationLayerInfo activation_info() const
Activation layer to apply after the matrix multiplication.
Definition: Types.h:2154

Member Function Documentation

◆ activation_info()

ActivationLayerInfo activation_info ( ) const
inline

Activation layer to apply after the matrix multiplication.

Returns
ActivationLayerInfo object

Definition at line 2154 of file Types.h.

Referenced by NEGEMM::configure(), NEGEMMLowpMatrixMultiplyCore::configure(), NEGEMM::validate(), and NEGEMMLowpMatrixMultiplyCore::validate().

2155  {
2156  return _activation_info;
2157  }

◆ broadcast_bias()

bool broadcast_bias ( ) const
inline

Flag which specifies whether to broadcast the shape of the bias tensor.

Returns
True if the shape of the bias tensor is to be broadcasted.

Definition at line 2130 of file Types.h.

Referenced by arm_compute::operator<<().

2131  {
2132  return _broadcast_bias;
2133  };

◆ depth_output_gemm3d()

int depth_output_gemm3d ( ) const
inline

Depth of the output when GEMM output is reinterpreted as 3D tensor.

Returns
the depth of the output tensor

Definition at line 2082 of file Types.h.

Referenced by CLGEMMLowpMatrixMultiplyCore::configure(), arm_compute::operator<<(), NEGEMM::validate(), and CLGEMMLowpMatrixMultiplyCore::validate().

2083  {
2084  return _depth_output_gemm3d;
2085  };

◆ fp_mixed_precision()

bool fp_mixed_precision ( ) const
inline

Flag which specifies if a wider accumulator should be used.

Returns
True if a wider accumulator has to be used

Definition at line 2122 of file Types.h.

Referenced by arm_compute::operator<<().

2123  {
2124  return _fp_mixed_precision;
2125  };

◆ gemmlowp_output_stage()

GEMMLowpOutputStageInfo gemmlowp_output_stage ( ) const
inline

GEMMLowp output stage.

Returns
the GEMMLowp output stage info

Definition at line 2106 of file Types.h.

Referenced by NEGEMMLowpMatrixMultiplyCore::configure(), CLGEMMLowpMatrixMultiplyCore::configure(), NEGEMMLowpMatrixMultiplyCore::validate(), and CLGEMMLowpMatrixMultiplyCore::validate().

2107  {
2108  return _gemmlowp_output_stage;
2109  };

◆ is_a_reshaped()

bool is_a_reshaped ( ) const
inline

Flag which specifies if the matrix A has been reshaped.

Returns
True if the matrix A has been reshaped

Definition at line 2056 of file Types.h.

Referenced by arm_compute::operator<<(), NEGEMM::validate(), NEGEMMLowpMatrixMultiplyCore::validate(), and CLGEMMLowpMatrixMultiplyCore::validate().

2057  {
2058  return _is_a_reshaped;
2059  };

◆ is_b_reshaped()

bool is_b_reshaped ( ) const
inline

Flag which specifies if the matrix B has been reshaped.

Returns
True if the matrix B has been reshaped

Definition at line 2064 of file Types.h.

Referenced by arm_compute::operator<<(), NEGEMM::validate(), NEGEMMLowpMatrixMultiplyCore::validate(), and CLGEMMLowpMatrixMultiplyCore::validate().

2065  {
2066  return _is_b_reshaped;
2067  };

◆ pretranpose_B()

bool pretranpose_B ( ) const
inline

Flag which specifies whether b should be pre-transposed if supported.

Returns
True if b should be pre-transposed else false.

Definition at line 2138 of file Types.h.

Referenced by arm_compute::operator<<().

2139  {
2140  return _pretranpose_B;
2141  };

◆ reinterpret_input_as_3d()

bool reinterpret_input_as_3d ( ) const
inline

Flag which specifies if the input tensor has to be reinterpreted as 3D.

Returns
True if the input tensor has to be reinterpreted as 3D tensor

Definition at line 2090 of file Types.h.

Referenced by CLGEMMLowpMatrixMultiplyCore::configure(), CLGEMM::configure(), arm_compute::operator<<(), NEGEMM::validate(), CLGEMMLowpMatrixMultiplyCore::validate(), and CLGEMM::validate().

2091  {
2092  return _reinterpret_input_as_3d;
2093  };

◆ reshape_b_only_on_first_run()

bool reshape_b_only_on_first_run ( ) const
inline

Flag which specifies if the reshape of matrix B should executed only for the first.

Note
This flag could be set to TRUE when GEMM is used to accelerate convolution layer
Returns
True if the reshaped of matrix B happens only for the first run

Definition at line 2074 of file Types.h.

Referenced by GCGEMM::configure(), NEGEMM::configure(), NEGEMMLowpMatrixMultiplyCore::configure(), CLGEMMLowpMatrixMultiplyCore::configure(), CLGEMM::configure(), arm_compute::operator<<(), NEGEMM::validate(), CLGEMMLowpMatrixMultiplyCore::validate(), and CLGEMM::validate().

2075  {
2076  return _reshape_b_only_on_first_run;
2077  };

◆ retain_internal_weights()

bool retain_internal_weights ( ) const
inline

Flag which specifies if the weights tensor has to be retained from previous run.

Returns
True if the weights tensor has to be retained

Definition at line 2098 of file Types.h.

Referenced by CLGEMM::configure(), and arm_compute::operator<<().

2099  {
2100  return _retain_internal_weights;
2101  };

◆ set_activation_info()

void set_activation_info ( const ActivationLayerInfo activation_info)
inline

Set activation layer info.

Parameters
[in]activation_infoActivationLayerInfo object to set

Definition at line 2162 of file Types.h.

2163  {
2164  _activation_info = activation_info;
2165  }
ActivationLayerInfo activation_info() const
Activation layer to apply after the matrix multiplication.
Definition: Types.h:2154

◆ set_gemmlowp_output_stage()

void set_gemmlowp_output_stage ( GEMMLowpOutputStageInfo output_stage)
inline

Sets GEMMLowp output stage.

Parameters
[in]output_stageOutput stage to set

Definition at line 2114 of file Types.h.

Referenced by NEGEMMLowpMatrixMultiplyCore::configure().

2115  {
2116  _gemmlowp_output_stage = output_stage;
2117  };

◆ set_pretranpose_B()

void set_pretranpose_B ( bool  flag)
inline

Set pre-transpose b flag.

Parameters
[in]flagFlag to set

Definition at line 2146 of file Types.h.

2147  {
2148  _pretranpose_B = flag;
2149  }

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