summaryrefslogtreecommitdiff
path: root/torch/functional.py
diff options
context:
space:
mode:
authorWei Yang <weiyang@fb.com>2018-09-29 22:23:36 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-09-29 22:26:45 -0700
commit5ffc915f26a7759d3a24b692599a49db2ef6b0c0 (patch)
tree42a30b5f2abcaa17c8fc62f78e60892cb4712be3 /torch/functional.py
parent40aa212cd65c2852d35ce3e43c731d63599aefbb (diff)
downloadpytorch-5ffc915f26a7759d3a24b692599a49db2ef6b0c0.tar.gz
pytorch-5ffc915f26a7759d3a24b692599a49db2ef6b0c0.tar.bz2
pytorch-5ffc915f26a7759d3a24b692599a49db2ef6b0c0.zip
fix docs (#12126)
Summary: - fix https://github.com/pytorch/pytorch/issues/12120 - add `torch.argsort`, `torch.pdist`, `broadcast_tensors` to *.rst files - add parameter dim to `torch.unique` doc - fix table and args for `torch.norm` - test plan: make html and check docs in browser gchanan Pull Request resolved: https://github.com/pytorch/pytorch/pull/12126 Differential Revision: D10087006 Pulled By: weiyangfb fbshipit-source-id: 25f65c43d14e02140d0da988d8742c7ade3d8cc9
Diffstat (limited to 'torch/functional.py')
-rw-r--r--torch/functional.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/torch/functional.py b/torch/functional.py
index 0eac8f1674..47625171c5 100644
--- a/torch/functional.py
+++ b/torch/functional.py
@@ -439,6 +439,8 @@ def unique(input, sorted=False, return_inverse=False, dim=None):
before returning as output.
return_inverse (bool): Whether to also return the indices for where
elements in the original input ended up in the returned unique list.
+ dim (int): the dimension to apply unique. If ``None``, the unique of the
+ flattened input is returned. default: ``None``
Returns:
(Tensor, Tensor (optional)): A tensor or a tuple of tensors containing
@@ -646,8 +648,9 @@ def norm(input, p="fro", dim=None, keepdim=False, out=None):
Args:
input (Tensor): the input tensor
- p ({int, float, inf, -inf, 'fro', 'nuc'}): the order of norm
+ p (int, float, inf, -inf, 'fro', 'nuc'): the order of norm
The following norms can be calculated:
+
===== ============================ ==========================
ord matrix norm vector norm
===== ============================ ==========================
@@ -656,18 +659,19 @@ def norm(input, p="fro", dim=None, keepdim=False, out=None):
'nuc' nuclear norm --
Other as vec norm when dim is None sum(abs(x)**ord)**(1./ord)
===== ============================ ==========================
- dim ({int, 2-tuple of ints, 2-list of ints}, optional): If it is an int,
- vector norm will be calculated, if it is 2-tuple of ints, matrix norm
- will be calculated. If the value is None, matrix norm will be calculated
- when the input tensor only has two dimensions, vector norm will be
- calculated when the input tensor only has one dimension. If the input
- tensor has more than two dimensions, the vector norm will be applied to
- last dimension.
+
+ dim (int, 2-tuple of ints, 2-list of ints, optional): If it is an int,
+ vector norm will be calculated, if it is 2-tuple of ints, matrix norm
+ will be calculated. If the value is None, matrix norm will be calculated
+ when the input tensor only has two dimensions, vector norm will be
+ calculated when the input tensor only has one dimension. If the input
+ tensor has more than two dimensions, the vector norm will be applied to
+ last dimension.
keepdim (bool): whether the output tensors have :attr:`dim`
- retained or not. Ignored if attr:`dim`=``None`` and
- :attr:`out`=``None``.
+ retained or not. Ignored if :attr:`dim` = ``None`` and
+ :attr:`out` = ``None``.
out (Tensor, optional): the output tensor. Ignored if
- attr:`dim`=``None`` and :attr:`out`=``None``.
+ :attr:`dim` = ``None`` and :attr:`out` = ``None``.
Example::
>>> import torch