diff options
author | atkayu <yuekaiyu0307@gmail.com> | 2016-12-28 11:26:09 +0300 |
---|---|---|
committer | atkayu <yuekaiyu0307@gmail.com> | 2016-12-28 11:26:09 +0300 |
commit | 6f0cde0f5fd8f3fbff3647012c9f80fc9a6558dc (patch) | |
tree | 06c6091cb0cb0715b3125b7ea3b37b22f18da757 | |
parent | af9848f872c23ce7f8b40fa1b33fc5e3a277c2d3 (diff) |
rename histc2 to bhistc
-rw-r--r-- | TensorMath.lua | 4 | ||||
-rwxr-xr-x | doc/maths.md | 12 | ||||
-rw-r--r-- | lib/TH/generic/THTensorMath.c | 2 | ||||
-rw-r--r-- | lib/TH/generic/THTensorMath.h | 2 | ||||
-rw-r--r-- | test/test.lua | 6 |
5 files changed, 13 insertions, 13 deletions
diff --git a/TensorMath.lua b/TensorMath.lua index e8cb97b..ec875b0 100644 --- a/TensorMath.lua +++ b/TensorMath.lua @@ -1089,8 +1089,8 @@ static void THTensor_random1__(THTensor *self, THGenerator *gen, long b) {name="double",default=0}, {name="double",default=0}}) - wrap("histc2", - cname("histc2"), + wrap("bhistc", + cname("bhistc"), {{name=Tensor, default=true, returned=true}, {name=Tensor}, {name="long",default=100}, diff --git a/doc/maths.md b/doc/maths.md index 433bf52..b5b1395 100755 --- a/doc/maths.md +++ b/doc/maths.md @@ -150,11 +150,11 @@ By default the elements are sorted into 100 equally spaced bins between the mini `y = torch.histc(x, n, min, max)` same as above with `n` bins and `[min, max]` as elements range. -<a name="torch.histc2"></a> -### [res] torch.histc2([res,] x [,nbins, min_value, max_value]) ### -<a name="torch.histc2"></a> +<a name="torch.bhistc"></a> +### [res] torch.bhistc([res,] x [,nbins, min_value, max_value]) ### +<a name="torch.bhistc"></a> -`y = torch.histc2(x)` returns the histogram of the elements in 2d tensor `x` along the last dimension. +`y = torch.bhistc(x)` returns the histogram of the elements in 2d tensor `x` along the last dimension. By default the elements are sorted into 100 equally spaced bins between the minimum and maximum values of `x`. `y = torch.histc(x, n)` same as above with `n` bins. @@ -174,7 +174,7 @@ x =torch.Tensor(3, 6) 3 4 2 5 5 1 [torch.DoubleTensor of size 3x6] -> torch.histc2(x, 5, 1, 5) +> torch.bhistc(x, 5, 1, 5) 0 3 0 2 1 1 0 2 0 3 1 1 1 1 2 @@ -182,7 +182,7 @@ x =torch.Tensor(3, 6) > y = torch.Tensor(1, 6):copy(x[1]) -> torch.histc2(y, 5) +> torch.bhistc(y, 5) 3 0 2 0 1 [torch.DoubleTensor of size 1x5] ``` diff --git a/lib/TH/generic/THTensorMath.c b/lib/TH/generic/THTensorMath.c index 765f9c4..fff60a5 100644 --- a/lib/TH/generic/THTensorMath.c +++ b/lib/TH/generic/THTensorMath.c @@ -2538,7 +2538,7 @@ void THTensor_(histc)(THTensor *hist, THTensor *tensor, long nbins, real minvalu ); } -void THTensor_(histc2)(THTensor *hist, THTensor *tensor, long nbins, real minvalue, real maxvalue) +void THTensor_(bhistc)(THTensor *hist, THTensor *tensor, long nbins, real minvalue, real maxvalue) { THArgCheck(THTensor_(nDimension)(tensor) < 3, 2, "invalid dimension %d, the input must be a 2d tensor", THTensor_(nDimension)(tensor)); diff --git a/lib/TH/generic/THTensorMath.h b/lib/TH/generic/THTensorMath.h index 3908c27..f5e5c1b 100644 --- a/lib/TH/generic/THTensorMath.h +++ b/lib/TH/generic/THTensorMath.h @@ -163,7 +163,7 @@ TH_API void THTensor_(norm)(THTensor *r_, THTensor *t, real value, int dimension TH_API void THTensor_(renorm)(THTensor *r_, THTensor *t, real value, int dimension, real maxnorm); TH_API accreal THTensor_(dist)(THTensor *a, THTensor *b, real value); TH_API void THTensor_(histc)(THTensor *hist, THTensor *tensor, long nbins, real minvalue, real maxvalue); -TH_API void THTensor_(histc2)(THTensor *hist, THTensor *tensor, long nbins, real minvalue, real maxvalue); +TH_API void THTensor_(bhistc)(THTensor *hist, THTensor *tensor, long nbins, real minvalue, real maxvalue); TH_API accreal THTensor_(meanall)(THTensor *self); TH_API accreal THTensor_(varall)(THTensor *self); diff --git a/test/test.lua b/test/test.lua index 4ab2f4a..f68835b 100644 --- a/test/test.lua +++ b/test/test.lua @@ -1355,17 +1355,17 @@ 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() +function torchtest.bhistc() 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 y = torch.bhistc(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') + mytester:assertTensorEq(y,z,precision,'error in torch.bhistc in last dimension') end function torchtest.ones() local mx = torch.ones(msize,msize) |