summaryrefslogtreecommitdiff
path: root/caffe2
diff options
context:
space:
mode:
authorAlexander Sidorov <salex@fb.com>2019-04-09 16:32:52 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2019-04-09 16:42:12 -0700
commit0ca8f7a15f16f75514515251f016fb2ff8c40137 (patch)
treeb16969d3bee5cef3979b30b4a224b05553c6de02 /caffe2
parent168c0797c45c1a26b0612c8496fe4ad112aeabfd (diff)
downloadpytorch-0ca8f7a15f16f75514515251f016fb2ff8c40137.tar.gz
pytorch-0ca8f7a15f16f75514515251f016fb2ff8c40137.tar.bz2
pytorch-0ca8f7a15f16f75514515251f016fb2ff8c40137.zip
Make BlackBoxPredictor handle networks throwing exceptions (#19080)
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
Diffstat (limited to 'caffe2')
-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(