diff options
Diffstat (limited to 'doc/maths.md')
-rwxr-xr-x | doc/maths.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/maths.md b/doc/maths.md index 252b52d..433bf52 100755 --- a/doc/maths.md +++ b/doc/maths.md @@ -150,6 +150,43 @@ 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> + +`y = torch.histc2(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. + +`y = torch.histc(x, n, min, max)` same as above with `n` bins and `[min, max]` as elements range. + +```lua +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 } + +> x + 2 4 2 2 5 4 + 3 5 1 5 3 5 + 3 4 2 5 5 1 +[torch.DoubleTensor of size 3x6] + +> torch.histc2(x, 5, 1, 5) + 0 3 0 2 1 + 1 0 2 0 3 + 1 1 1 1 2 +[torch.DoubleTensor of size 3x5] + +> y = torch.Tensor(1, 6):copy(x[1]) + +> torch.histc2(y, 5) + 3 0 2 0 1 +[torch.DoubleTensor of size 1x5] +``` + <a name="torch.linspace"></a> ### [res] torch.linspace([res,] x1, x2, [,n]) ### <a name="torch.linspace"></a> |