summaryrefslogtreecommitdiff
path: root/aten/tools
diff options
context:
space:
mode:
authorgchanan <gregchanan@gmail.com>2017-11-07 21:28:17 -0500
committerGitHub <noreply@github.com>2017-11-07 21:28:17 -0500
commitdaf2743bbb799f71287978f4b4c48b285d7757a6 (patch)
tree113a95f6e20e0ff871f88a62bbcd3d4b83007181 /aten/tools
parentdc10083fc0ac4f89dc7597ec3135d9e49a4fa3ea (diff)
downloadpytorch-daf2743bbb799f71287978f4b4c48b285d7757a6.tar.gz
pytorch-daf2743bbb799f71287978f4b4c48b285d7757a6.tar.bz2
pytorch-daf2743bbb799f71287978f4b4c48b285d7757a6.zip
Prevent segfaults from undefined aten tensors (#3482)
* Prevent segfaults from undefined aten tensors. This introduces a singleton UndefinedTensor TensorImpl with UndefinedType that is the starting state of a Tensor with no constructor arguments. In this way we avoid null pImpls and avoid segfaults without having to if-check each pImpl dereference. * If either Backend or Scalar type is Undefined in registry, return the UndefinedType to avoid errors like CPUUndefinedType is not enabled. * Address review comments. * Avoid refcounting UndefinedTensors. * Use reference_wrapper to avoid copy in check_defined. * Declare UndefinedTensor singleton as class-static. * Seperate checked_cast into storage and tensor versions. * Include <functional> * Handle nullptr TensorImpls coming from NN. * Fix nullptr check in batch_normalization backward with defined check.
Diffstat (limited to 'aten/tools')
-rwxr-xr-xaten/tools/run_tests.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/aten/tools/run_tests.sh b/aten/tools/run_tests.sh
index 0151acb0b8..f085993d6a 100755
--- a/aten/tools/run_tests.sh
+++ b/aten/tools/run_tests.sh
@@ -12,6 +12,7 @@ $BUILD_ROOT/src/ATen/test/wrapdim_test
$BUILD_ROOT/src/ATen/test/dlconvertor_test
$BUILD_ROOT/src/ATen/test/native_test
$BUILD_ROOT/src/ATen/test/scalar_tensor_test
+$BUILD_ROOT/src/ATen/test/undefined_tensor_test
if [ "$VALGRIND" == "ON" ]
then
valgrind --suppressions=`dirname $0`/valgrind.sup --error-exitcode=1 $BUILD_ROOT/src/ATen/test/basic -n