aboutsummaryrefslogtreecommitdiff
path: root/tests/Utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Utils.h')
-rw-r--r--tests/Utils.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/Utils.h b/tests/Utils.h
index bee30af2e8..d5c0a36ba2 100644
--- a/tests/Utils.h
+++ b/tests/Utils.h
@@ -476,6 +476,24 @@ inline T create_tensor(const TensorShape &shape, DataType data_type, int num_cha
return tensor;
}
+/** Create and initialize a tensor of the given type.
+ *
+ * @param[in] shape Tensor shape.
+ * @param[in] format Format type.
+ *
+ * @return Initialized tensor of given type.
+ */
+template <typename T>
+inline T create_tensor(const TensorShape &shape, Format format)
+{
+ TensorInfo info(shape, format);
+
+ T tensor;
+ tensor.allocator()->init(info);
+
+ return tensor;
+}
+
/** Create a vector of random ROIs.
*
* @param[in] shape The shape of the input tensor.