diff options
author | atkayu <yuekaiyu0307@gmail.com> | 2016-12-22 05:11:58 +0300 |
---|---|---|
committer | atkayu <yuekaiyu0307@gmail.com> | 2016-12-22 05:11:58 +0300 |
commit | af9848f872c23ce7f8b40fa1b33fc5e3a277c2d3 (patch) | |
tree | 99a1cc409bf5ce7bfc41ba9bb5eeb4d95aee8a1c /test | |
parent | 7ca7ec9d08f1ef2c753e72cbd014397736d6b5af (diff) |
add a new function histc2
Diffstat (limited to 'test')
-rw-r--r-- | test/test.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua index 3eb119f..4ab2f4a 100644 --- a/test/test.lua +++ b/test/test.lua @@ -1355,6 +1355,18 @@ function torchtest.histc() local z = torch.Tensor{ 0, 3, 0, 2, 1 } mytester:assertTensorEq(y,z,precision,'error in torch.histc') end +function torchtest.histc2() + local x = torch.Tensor(3, 6) + x[1] = torch.Tensor{ 2, 4, 2, 2, 5, 4 } + x[2] = torch.Tensor{ 3, 5, 1, 5, 3, 5 } + x[3] = torch.Tensor{ 3, 4, 2, 5, 5, 1 } + local y = torch.histc2(x, 5, 1, 5) -- nbins, min, max + local z = torch.Tensor(3, 5) + z[1] = torch.Tensor{ 0, 3, 0, 2, 1 } + z[2] = torch.Tensor{ 1, 0, 2, 0, 3 } + z[3] = torch.Tensor{ 1, 1, 1, 1, 2 } + mytester:assertTensorEq(y,z,precision,'error in torch.histc2 in last dimension') +end function torchtest.ones() local mx = torch.ones(msize,msize) local mxx = torch.Tensor() |