diff options
author | Pablo Marquez Tello <pablo.tello@arm.com> | 2021-09-15 10:14:20 +0100 |
---|---|---|
committer | Sheri Zhang <sheri.zhang@arm.com> | 2021-09-16 09:59:54 +0000 |
commit | 9ac7b99106e24ab426d8a948dd5243defb753b32 (patch) | |
tree | 1eedc0be5bba626afceecfb9d5d4436e3ac38502 /arm_compute/core/Types.h | |
parent | cc171f9e4520e16b5e1b9c483562ed022d9151fa (diff) | |
download | ComputeLibrary-9ac7b99106e24ab426d8a948dd5243defb753b32.tar.gz |
Revert "Add support for non-constant weights and biases in CpuFullyConnected"
This reverts commit aed63ee175e0d64c934389e9d1b2edd0cb1a5cdd.
* Resolves COMPMID-4812
Change-Id: I16919e2f3b22c868ae146d0d10dae97a80e1ba46
Signed-off-by: Pablo Marquez Tello <pablo.tello@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6266
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Sheri Zhang <sheri.zhang@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/Types.h')
-rw-r--r-- | arm_compute/core/Types.h | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h index 31199e138b..0dd1afc240 100644 --- a/arm_compute/core/Types.h +++ b/arm_compute/core/Types.h @@ -1557,6 +1557,7 @@ struct FullyConnectedLayerInfo bool transpose_weights{ true }; /**< Transpose weights if true. */ bool are_weights_reshaped{ false }; /**< Reshape the weights tensor if false. */ bool retain_internal_weights{ false }; /**< Retain internal reshaped weights. */ + bool constant_weights{ true }; /**< If false, weights can vary between runs. */ /* Other parameters */ bool fp_mixed_precision{ false }; /**< Use wider accumulators (32 bit instead of 16 for FP16) to improve accuracy. */ @@ -1963,8 +1964,9 @@ public: _fast_math(false), _fp_mixed_precision(false), _broadcast_bias(false), - _pretranspose_B(true), - _activation_info() + _pretranpose_B(true), + _activation_info(), + _constant_weights(true) { } /** Constructor @@ -1982,10 +1984,11 @@ public: * @param[in] fast_math (Optional) Use a data type of shorter width to improve performance * @param[in] broadcast_bias (Optional) Broadcast the shape of the bias tensor from a vector to a matrix. * @param[in] activation_info (Optional) Activation to apply after the matrix multiplication + * @param[in] constant_weights (Optional) Weights have constant values throughout multiple executions */ 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 fast_math = false, bool broadcast_bias = false, - const ActivationLayerInfo &activation_info = ActivationLayerInfo()) noexcept + const ActivationLayerInfo &activation_info = ActivationLayerInfo(), bool constant_weights = true) noexcept : _is_a_reshaped(is_a_reshaped), _is_b_reshaped(is_b_reshaped), _reshape_b_only_on_first_run(reshape_b_only_on_first_run), @@ -1996,8 +1999,9 @@ public: _fast_math(fast_math), _fp_mixed_precision(fp_mixed_precision), _broadcast_bias(broadcast_bias), - _pretranspose_B(reshape_b_only_on_first_run), - _activation_info(activation_info) + _pretranpose_B(reshape_b_only_on_first_run), + _activation_info(activation_info), + _constant_weights(constant_weights) { } /** Flag which specifies if the matrix A has been reshaped @@ -2094,17 +2098,17 @@ public: * * @return True if b should be pre-transposed else false. */ - bool pretranspose_B() const + bool pretranpose_B() const { - return _pretranspose_B; + return _pretranpose_B; }; /** Set pre-transpose b flag * * @param[in] flag Flag to set */ - void set_pretranspose_B(bool flag) + void set_pretranpose_B(bool flag) { - _pretranspose_B = flag; + _pretranpose_B = flag; } /** Activation layer to apply after the matrix multiplication * @@ -2122,6 +2126,14 @@ public: { _activation_info = activation_info; } + /** Flag which specifies if the values of the weights tensor are constant throughout multiple executions or not + * + * @return True if the weights tensor is constant + */ + bool constant_weights() const + { + return _constant_weights; + }; private: bool _is_a_reshaped; @@ -2134,8 +2146,9 @@ private: bool _fast_math; bool _fp_mixed_precision; bool _broadcast_bias; - bool _pretranspose_B; + bool _pretranpose_B; ActivationLayerInfo _activation_info; + bool _constant_weights; }; /** Winograd information */ |