Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/torch7.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMalcolm Reynolds <malcolm.reynolds@gmail.com>2016-03-04 16:40:45 +0300
committerMalcolm Reynolds <malcolm.reynolds@gmail.com>2016-03-04 16:40:45 +0300
commit9c6e00054b80f1569c1ac0ccc1bf8b1ae48f0e0e (patch)
treed632c821c6bca62cf6170055850b8ab6870b7ea3 /test
parent34c48cb986593b309452e2c8ebfbf938d59e4be6 (diff)
Fix a bug in :isSetTo
The case of self->storage == NULL was not checked, so any two Tensors with no storage would effectively appear to be shared with each other. Added a test to prevent regressions.
Diffstat (limited to 'test')
-rw-r--r--test/test.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua
index f86fc72..d1bb96c 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -2935,6 +2935,9 @@ function torchtest.isSetTo()
mytester:assert(t1:isSetTo(t3) == true, "tensor is set to other")
mytester:assert(t3:isSetTo(t1) == true, "isSetTo should be symmetric")
mytester:assert(t1:isSetTo(t4) == false, "tensors have different view")
+ mytester:assert(not torch.Tensor():isSetTo(torch.Tensor()),
+ "Tensors with no storages should not appear to be set " ..
+ "to each other")
end
function torchtest.isSize()