diff options
author | Moritz Pflanzer <moritz.pflanzer@arm.com> | 2017-06-30 12:48:43 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-09-17 14:15:39 +0100 |
commit | 94450f1fc91a89778354c2e1c07a328ba86d9cfc (patch) | |
tree | 9a84b1b86f5361027492b6698ea946d2e321baba /tests/Utils.h | |
parent | d4f8c27f08c968f608a9e0e9b88df1871f62cdd3 (diff) | |
download | ComputeLibrary-94450f1fc91a89778354c2e1c07a328ba86d9cfc.tar.gz |
COMPMID-417: Use a common create_tensor function
Change-Id: I6b0511484a5b433ebec3fd62d778e64dcb4f89b5
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79362
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/Utils.h')
-rw-r--r-- | tests/Utils.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/Utils.h b/tests/Utils.h index 3be046182a..8d5046da34 100644 --- a/tests/Utils.h +++ b/tests/Utils.h @@ -397,6 +397,24 @@ inline bool is_in_valid_region(const ValidRegion &valid_region, const Coordinate } return true; } + +/** Create and initialize a tensor of the given type. + * + * @param[in] shape Tensor shape. + * @param[in] data_type Data type. + * @param[in] num_channels (Optional) Number of channels. + * @param[in] fixed_point_position (Optional) Number of fractional bits. + * + * @return Initialized tensor of given type. + */ +template <typename T> +inline T create_tensor(const TensorShape &shape, DataType data_type, int num_channels = 1, int fixed_point_position = 0) +{ + T tensor; + tensor.allocator()->init(TensorInfo(shape, num_channels, data_type, fixed_point_position)); + + return tensor; +} } // namespace test } // namespace arm_compute #endif |