From 4d33630096c769dd43716dd5607f151e3d5abef7 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Fri, 2 Mar 2018 09:43:54 +0000 Subject: COMPMID-987: Make beta and gamma optional in BatchNormalization Currently we have beta and gamma compulsory in Batch normalization. There are network that might not need one or both of those. Thus these should be optional with beta(offset) defaulting to zero and gamma(scale) to 1. Will also reduce some memory requirements. Change-Id: I15bf1ec14b814be2acebf1be1a4fba9c4fbd3190 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/123237 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- tests/AssetsLibrary.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/AssetsLibrary.h') diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h index ae88824298..4bbe4c56f6 100644 --- a/tests/AssetsLibrary.h +++ b/tests/AssetsLibrary.h @@ -352,6 +352,16 @@ public: template void fill_layer_data(T &&tensor, std::string name) const; + /** Fill a tensor with a constant value + * + * @param[in, out] tensor To be filled tensor. + * @param[in] value Value to be assigned to all elements of the input tensor. + * + * @note @p value must be of the same type as the data type of @p tensor + */ + template + void fill_tensor_value(T &&tensor, D value) const; + private: // Function prototype to convert between image formats. using Converter = void (*)(const RawTensor &src, RawTensor &dst); @@ -774,6 +784,12 @@ void AssetsLibrary::fill_layer_data(T &&tensor, std::string name) const }); } } + +template +void AssetsLibrary::fill_tensor_value(T &&tensor, D value) const +{ + fill_tensor_uniform(tensor, 0, value, value); +} } // namespace test } // namespace arm_compute #endif /* __ARM_COMPUTE_TEST_TENSOR_LIBRARY_H__ */ -- cgit v1.2.1