diff options
author | Malcolm Reynolds <malcolm.reynolds@gmail.com> | 2016-03-04 16:40:45 +0300 |
---|---|---|
committer | Malcolm Reynolds <malcolm.reynolds@gmail.com> | 2016-03-04 16:40:45 +0300 |
commit | 9c6e00054b80f1569c1ac0ccc1bf8b1ae48f0e0e (patch) | |
tree | d632c821c6bca62cf6170055850b8ab6870b7ea3 /test | |
parent | 34c48cb986593b309452e2c8ebfbf938d59e4be6 (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.lua | 3 |
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() |