summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--caffe2/core/test_utils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/caffe2/core/test_utils.h b/caffe2/core/test_utils.h
index 7e286e1d30..bb31c2c7e4 100644
--- a/caffe2/core/test_utils.h
+++ b/caffe2/core/test_utils.h
@@ -98,6 +98,15 @@ caffe2::Tensor* createTensorAndFill(
return tensor;
}
+template <typename T>
+caffe2::Tensor createTensorAndFill(
+ const std::vector<int64_t>& shape,
+ const std::vector<T>& data) {
+ Tensor tensor(caffe2::CPU);
+ fillTensor<T>(shape, data, &tensor);
+ return tensor;
+}
+
// Fill a constant to a tensor.
template <typename T>
void constantFillTensor(