diff options
author | Thomas Viehmann <tv@beamnet.de> | 2019-01-18 15:27:12 -0800 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-01-18 15:34:35 -0800 |
commit | b662a9b66a0f1b7d79749ccd0fbf07245eee8f06 (patch) | |
tree | 6be02658275315eb86a741fe085a63a73526db7b /tools | |
parent | ed57425b0a42165397d40783aaba15d7b495bb86 (diff) | |
download | pytorch-b662a9b66a0f1b7d79749ccd0fbf07245eee8f06.tar.gz pytorch-b662a9b66a0f1b7d79749ccd0fbf07245eee8f06.tar.bz2 pytorch-b662a9b66a0f1b7d79749ccd0fbf07245eee8f06.zip |
add back NNPACK in PyTorch (#15924)
Summary:
This tests the water for adding back NNPACK in PyTorch, it's a lot better than the fallback THNN versions.
In #6151, we (ezyang and soumith) removed NNPACK support from PyTorch. Of course Maratyszcza might have advice, too. (Or an opinion on the CMake changes.)
The only functional changes are to use NNPack more aggressively on mobile and a .contiguous() to match NNPack's assumption (I stumbled over that while using NNPack for style transfer.)
The CMake changes try to use the NNPack we already have in git.
In terms of lines of code this is a large part of the diff of https://lernapparat.de/pytorch-jit-android/ . As far as I can tell, we don't have MKLDNN on mobile and the native THNN implementation are prohibitively expensive in terms of both CPU and memory.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15924
Differential Revision: D13709576
Pulled By: ezyang
fbshipit-source-id: f2e287739909451c173abf046588209a7450ca2c
Diffstat (limited to 'tools')
-rw-r--r-- | tools/autograd/derivatives.yaml | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/autograd/derivatives.yaml b/tools/autograd/derivatives.yaml index 2a93d4265b..cf6f2b24ff 100644 --- a/tools/autograd/derivatives.yaml +++ b/tools/autograd/derivatives.yaml @@ -1369,6 +1369,12 @@ save_var: not_implemented("cudnn_batch_norm_backward save_var") input, weight, grad_output: batchnorm_double_backward(input, weight, grads[0], grads[1], grads[2], grad_output, running_mean, running_var, true, epsilon, save_mean, save_var, grad_input_mask) +# nnpack + +- name: _nnpack_spatial_convolution(Tensor input, Tensor weight, Tensor bias, IntList padding) + input: _nnpack_spatial_convolution_backward_input(input, grad, weight, padding) + weight: _nnpack_spatial_convolution_backward_weight(input, weight.sizes(), grad, padding) + bias: grad.contiguous().view({grad.size(0), grad.size(1), -1}).sum(0).sum(1) # Only frst three of _cudnn_rnn outputs can have gradients. # _cudnn_rnn outputs: (output, hy, cy, reserve, weight_buf) |