aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorPablo Marquez Tello <pablo.tello@arm.com>2021-09-15 10:14:20 +0100
committerSheri Zhang <sheri.zhang@arm.com>2021-09-16 09:59:54 +0000
commit9ac7b99106e24ab426d8a948dd5243defb753b32 (patch)
tree1eedc0be5bba626afceecfb9d5d4436e3ac38502 /arm_compute
parentcc171f9e4520e16b5e1b9c483562ed022d9151fa (diff)
downloadComputeLibrary-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')
-rw-r--r--arm_compute/core/ITensorInfo.h12
-rw-r--r--arm_compute/core/SubTensorInfo.h11
-rw-r--r--arm_compute/core/TensorInfo.h10
-rw-r--r--arm_compute/core/Types.h33
4 files changed, 23 insertions, 43 deletions
diff --git a/arm_compute/core/ITensorInfo.h b/arm_compute/core/ITensorInfo.h
index bc3a6bed8c..0171e31086 100644
--- a/arm_compute/core/ITensorInfo.h
+++ b/arm_compute/core/ITensorInfo.h
@@ -240,11 +240,6 @@ public:
* @return True if its dynamic else false
*/
virtual bool is_dynamic() const = 0;
- /** Flag indicating whether the values of the tensor are constant, meaning that they can change on kernel/function execution.
- *
- * @return True if values are constant else false
- */
- virtual bool are_values_constant() const = 0;
/** Set the flag whether the tensor size can be changed.
*
* @param[in] is_resizable Flag that marks the tensor if it can be changed or not.
@@ -252,13 +247,6 @@ public:
* @return Reference to this ITensorInfo object
*/
virtual ITensorInfo &set_is_resizable(bool is_resizable) = 0;
- /** Set the flag whether the tensor values can change during kernel/function execution.
- *
- * @param[in] are_values_constant Flag that marks the tensor values if they can be changed or not.
- *
- * @return Reference to this ITensorInfo object
- */
- virtual ITensorInfo &set_are_values_constant(bool are_values_constant) = 0;
/** Valid region of the tensor. All elements in the valid region have defined values, i.e. are not undefined.
*
* @return The valid region.
diff --git a/arm_compute/core/SubTensorInfo.h b/arm_compute/core/SubTensorInfo.h
index 54836d0528..1b2278d99b 100644
--- a/arm_compute/core/SubTensorInfo.h
+++ b/arm_compute/core/SubTensorInfo.h
@@ -196,23 +196,12 @@ public:
ARM_COMPUTE_ERROR_ON(_parent == nullptr);
return _parent->is_dynamic();
}
- bool are_values_constant() const override
- {
- ARM_COMPUTE_ERROR_ON(_parent == nullptr);
- return _parent->are_values_constant();
- }
ITensorInfo &set_is_resizable(bool is_resizable) override
{
ARM_COMPUTE_ERROR_ON(_parent == nullptr);
_parent->set_is_resizable(is_resizable);
return *this;
}
- ITensorInfo &set_are_values_constant(bool are_values_constant) override
- {
- ARM_COMPUTE_ERROR_ON(_parent == nullptr);
- _parent->set_are_values_constant(are_values_constant);
- return *this;
- }
ValidRegion valid_region() const override
{
return _valid_region;
diff --git a/arm_compute/core/TensorInfo.h b/arm_compute/core/TensorInfo.h
index 9bc86806fb..a4330849bf 100644
--- a/arm_compute/core/TensorInfo.h
+++ b/arm_compute/core/TensorInfo.h
@@ -267,10 +267,6 @@ public:
{
return std::find(std::cbegin(_dims_state), std::cend(_dims_state), get_dynamic_state_value()) != std::cend(_dims_state);
}
- bool are_values_constant() const override
- {
- return _are_values_constant;
- }
ITensorInfo &set_is_resizable(bool is_resizable) override
{
_is_resizable = is_resizable;
@@ -292,11 +288,6 @@ public:
{
return _data_layout;
}
- ITensorInfo &set_are_values_constant(bool are_values_constant) override
- {
- _are_values_constant = are_values_constant;
- return *this;
- }
private:
/** Calculates strides, offset and total size resulting from the specified padding around the XY plane.
@@ -318,7 +309,6 @@ private:
PaddingSize _padding;
QuantizationInfo _quantization_info;
DataLayout _data_layout;
- bool _are_values_constant;
};
} // namespace arm_compute
#endif /*ARM_COMPUTE_TENSORINFO_H */
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 */