diff options
author | Andreas Köpf <andreas.koepf@xamla.com> | 2016-02-01 01:45:34 +0300 |
---|---|---|
committer | Andreas Köpf <andreas.koepf@xamla.com> | 2016-02-03 02:31:26 +0300 |
commit | 30cb5a431eafbfecc40e5c22e6b959663b1aa437 (patch) | |
tree | 9a9fefd70f2929f1c23f9a58522e6534d71f8d6f /THNN.lua | |
parent | 4644b8c61fba57fbacf16d4892ef3f1e37ed4bfd (diff) |
Add THNN conversion of Volumetric* modules
Diffstat (limited to 'THNN.lua')
-rw-r--r-- | THNN.lua | 148 |
1 files changed, 144 insertions, 4 deletions
@@ -3,6 +3,7 @@ local ffi = require 'ffi' local THNN = {} local generic_THNN_h = [[ + TH_API void THNN_(Abs_updateOutput)( THNNState *state, THTensor *input, @@ -147,11 +148,11 @@ TH_API void THNN_(LookupTable_accGradParameters)( THIndexTensor *input, THTensor *gradOutput, THTensor *gradWeight, - real scale, - bool scaleGradByFreq, THIntegerTensor *count, THTensor *sorted, - THTensor *indices); + THTensor *indices, + bool scaleGradByFreq, + real scale); TH_API void THNN_(MarginCriterion_updateOutput)( THNNState *state, @@ -453,6 +454,145 @@ TH_API void THNN_(SpatialMaxPooling_updateGradInput)( int dW, int dH, int padW, int padH, bool ceil_mode); + +TH_API void THNN_(VolumetricAveragePooling_updateOutput)( + THNNState *state, + THTensor *input, + THTensor *output, + int kT, int kW, int kH, + int dT, int dW, int dH); +TH_API void THNN_(VolumetricAveragePooling_updateGradInput)( + THNNState *state, + THTensor *input, + THTensor *gradOutput, + THTensor *gradInput, + int kT, int kW, int kH, + int dT, int dW, int dH); + +TH_API void THNN_(VolumetricConvolution_updateOutput)( + THNNState *state, + THTensor *input, + THTensor *output, + THTensor *weight, + THTensor *bias, + int dT, int dW, int dH, + int pT, int pW, int pH); +TH_API void THNN_(VolumetricConvolution_updateGradInput)( + THNNState *state, + THTensor *input, + THTensor *gradOutput, + THTensor *gradInput, + THTensor *weight, + int dT, int dW, int dH, + int pT, int pW, int pH); +TH_API void THNN_(VolumetricConvolution_accGradParameters)( + THNNState *state, + THTensor *input, + THTensor *gradOutput, + THTensor *gradWeight, + THTensor *gradBias, + int dT, int dW, int dH, + int pT, int pW, int pH, + real scale); + +TH_API void THNN_(VolumetricConvolutionMM_updateOutput)( + THNNState *state, + THTensor *input, + THTensor *output, + THTensor *weight, + THTensor *bias, + THTensor *finput, + int kT, int kW, int kH, + int dT, int dW, int dH, + int pT, int pW, int pH); +TH_API void THNN_(VolumetricConvolutionMM_updateGradInput)( + THNNState *state, + THTensor *input, + THTensor *gradOutput, + THTensor *gradInput, + THTensor *weight, + THTensor *finput, + THTensor *fgradInput, + int kT, int kW, int kH, + int dT, int dW, int dH, + int pT, int pW, int pH); +TH_API void THNN_(VolumetricConvolutionMM_accGradParameters)( + THNNState *state, + THTensor *input, + THTensor *gradOutput, + THTensor *gradWeight, + THTensor *gradBias, + THTensor *finput, + real scale); + +TH_API void THNN_(VolumetricFullConvolution_updateOutput)( + THNNState *state, + THTensor *input, + THTensor *output, + THTensor *weight, + THTensor *bias, + THTensor *finput, + THTensor *fgradInput, + int dT, int dW, int dH, + int pT, int pW, int pH); +TH_API void THNN_(VolumetricFullConvolution_updateGradInput)( + THNNState *state, + THTensor *input, + THTensor *gradOutput, + THTensor *gradInput, + THTensor *weight, + THTensor *finput, + THTensor *fgradInput, + int dT, int dW, int dH, + int pT, int pW, int pH); +TH_API void THNN_(VolumetricFullConvolution_accGradParameters)( + THNNState *state, + THTensor *input, + THTensor *gradOutput, + THTensor *gradWeight, + THTensor *gradBias, + THTensor *finput, + THTensor *fgradInput, + int dT, int dW, int dH, + int pT, int pW, int pH, + real scale); + +TH_API void THNN_(VolumetricMaxPooling_updateOutput)( + THNNState *state, + THTensor *input, + THTensor *output, + THTensor *indices, + int kT, int kW, int kH, + int dT, int dW, int dH, + int pT, int pW, int pH, + bool ceilMode); +TH_API void THNN_(VolumetricMaxPooling_updateGradInput)( + THNNState *state, + THTensor *input, + THTensor *gradOutput, + THTensor *gradInput, + THTensor *indices, + int dT, int dW, int dH, + int pT, int pW, int pH); + +TH_API void THNN_(VolumetricMaxUnpooling_updateOutput)( + THNNState *state, + THTensor *input, + THTensor *output, + THTensor *indices, + int oT, int oW, int oH, + int dT, int dW, int dH, + int pT, int pW, int pH); +TH_API void THNN_(VolumetricMaxUnpooling_updateGradInput)( + THNNState *state, + THTensor *input, + THTensor *gradOutput, + THTensor *gradInput, + THTensor *indices, + int oT, int oW, int oH, + int dT, int dW, int dH, + int pT, int pW, int pH); + ]] -- THGenerator struct declaration copied from torch7/lib/TH/THRandom.h @@ -496,7 +636,7 @@ ffi.cdef(base_declarations) -- expand macros, allow to use original lines from lib/THNN/generic/THNN.h local preprocessed = string.gsub(generic_THNN_h, 'TH_API void THNN_%(([%a%d_]+)%)', 'void THNN_TYPE%1') -local replacements = +local replacements = { { ['TYPE'] = 'Double', |