Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19080
OSS: add a tiny unit test utility function to create tensors given shape and data outside of any workspace. I use it in an internal test
Reviewed By: dzhulgakov
Differential Revision:
D14814194
fbshipit-source-id:
6d53b235d99a97da812215f5c7f11fecad363c8c
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(