diff options
author | Brennan Vincent <btv@fb.com> | 2018-11-28 06:50:49 -0800 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2018-11-28 06:53:09 -0800 |
commit | c638f379b3550556d9ec706d6dc39c23cc6799c3 (patch) | |
tree | 66dbb0302e5245512dade38bc4294582d387c48a /tools/autograd/derivatives.yaml | |
parent | 68251fb93196a4c28a0c9f9ce37896b21c6c04e0 (diff) | |
download | pytorch-c638f379b3550556d9ec706d6dc39c23cc6799c3.tar.gz pytorch-c638f379b3550556d9ec706d6dc39c23cc6799c3.tar.bz2 pytorch-c638f379b3550556d9ec706d6dc39c23cc6799c3.zip |
Make `mean` function work across multiple dimensions. (#14252)
Summary:
Multi-dimensional `sum` is already implemented, and it's trivial to implement `mean` in terms of `sum`, so just do it.
Bonus: Fix incomplete language in the `torch.sum` documentation which doesn't take into account multiple dimensions when describing `unsqueeze` (at the same time as introducing similar language in `torch.mean`).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14252
Differential Revision: D13161157
Pulled By: umanwizard
fbshipit-source-id: c45da692ba83c0ec80815200c5543302128da75c
Diffstat (limited to 'tools/autograd/derivatives.yaml')
-rw-r--r-- | tools/autograd/derivatives.yaml | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/autograd/derivatives.yaml b/tools/autograd/derivatives.yaml index 30432a21b8..ad83012a3b 100644 --- a/tools/autograd/derivatives.yaml +++ b/tools/autograd/derivatives.yaml @@ -470,7 +470,7 @@ self: grad.clone().masked_fill_(self <= other, 0) other: grad.clone().masked_fill_(self > other, 0) -- name: mean(Tensor self, int64_t dim, bool keepdim) +- name: mean(Tensor self, IntList dim, bool keepdim) self: sum_backward(grad, self.sizes(), dim, keepdim) / _safe_size(self.sizes(), dim) - name: mean(Tensor self) |