aboutsummaryrefslogtreecommitdiff
path: root/tests/AssetsLibrary.h
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2018-03-02 09:43:54 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:49:37 +0000
commit4d33630096c769dd43716dd5607f151e3d5abef7 (patch)
tree762897c2acac9553c0dad688d0c21842c8edff16 /tests/AssetsLibrary.h
parent1cd41495153c4e89d6195b42f870967339c1a13b (diff)
downloadComputeLibrary-4d33630096c769dd43716dd5607f151e3d5abef7.tar.gz
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 <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/AssetsLibrary.h')
-rw-r--r--tests/AssetsLibrary.h16
1 files changed, 16 insertions, 0 deletions
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 <typename T>
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 <typename T, typename D>
+ 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 <typename T, typename D>
+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__ */