Caffe2 - C++ API
A deep learning, cross platform ML framework
THNN.h
1 #ifndef TH_GENERIC_FILE
2 #define TH_GENERIC_FILE "THNN/generic/THNN.h"
3 #else
4 
5 #include <ATen/core/Reduction.h>
6 
7 TH_API void THNN_(AbsCriterion_updateOutput)(
8  THNNState *state, // library's state
9  THTensor *input, // input tensor
10  THTensor *target, // tensor with target values
11  THTensor *output, // [OUT] a one-element tensor with loss
12  int64_t reduction);
13 TH_API void THNN_(AbsCriterion_updateGradInput)(
14  THNNState *state, // library's state
15  THTensor *input, // input tensor
16  THTensor *target, // tensor with target values
17  THTensor *gradOutput,
18  THTensor *gradInput, // [OUT] gradient w.r.t. input
19  int64_t reduction);
20 
21 TH_API void THNN_(BCECriterion_updateOutput)(
22  THNNState *state,
23  THTensor *input,
24  THTensor *target,
25  THTensor *output,
26  int64_t reduction,
27  THTensor *weights); // [OPTIONAL]
28 TH_API void THNN_(BCECriterion_updateGradInput)(
29  THNNState *state,
30  THTensor *input,
31  THTensor *target,
32  THTensor *gradOutput,
33  THTensor *gradInput,
34  int64_t reduction,
35  THTensor *weights); // [OPTIONAL]
36 
37 TH_API void THNN_(ClassNLLCriterion_updateOutput)(
38  THNNState *state, // library's state
39  THTensor *input, // input tensor (1D/2D)
40  THIndexTensor *target, // tensor containing indexes of target classes
41  THTensor *output, // [OUT] a one-element tensor with loss
42  int64_t reduction,
43  THTensor *weights, // [OPTIONAL] class weights
44  THTensor *total_weight, // [BUFFER]
45  int64_t ignore_index); // target index to ignore (loss = 0, gradInput = 0)
46 TH_API void THNN_(ClassNLLCriterion_updateGradInput)(
47  THNNState *state, // library's state
48  THTensor *input, // input tensor (1D/2D)
49  THIndexTensor *target, // tensor containing indexes of target classes
50  THTensor *gradOutput,
51  THTensor *gradInput, // [OUT] gradient w.r.t. input
52  int64_t reduction,
53  THTensor *weights, // [OPTIONAL] class weights
54  THTensor *total_weight, // [BUFFER]
55  int64_t ignore_index); // target index to ignore (loss = 0, gradInput = 0)
56 
57 TH_API void THNN_(ELU_updateOutput)(
58  THNNState *state, // library's state
59  THTensor *input, // input tensor
60  THTensor *output, // [OUT] ELU output
61  accreal alpha, // an ELU parameter (as in paper)
62  accreal scale, // scaling factor for output
63  accreal input_scale, // scaling factor for input
64  bool inplace); // if true, modifies gradOutput and sets gradInput onto it (no additional memory is allocated)
65 TH_API void THNN_(ELU_updateGradInput)(
66  THNNState *state, // library's state
67  THTensor *gradOutput, // gradient w.r.t. output
68  THTensor *gradInput, // [OUT] gradient w.r.t. input
69  THTensor *output, // output from a forward pass
70  accreal alpha, // an ELU parameter (as in paper)
71  accreal scale,
72  accreal input_scale);
73 
74 TH_API void THNN_(GatedLinear_updateOutput)(
75  THNNState *state, // library's state
76  THTensor *input, // input tensor
77  THTensor *output, // [OUT] output tensor, half size of input along dimension dim
78  int dim); // dimension for halving operation
79 TH_API void THNN_(GatedLinear_updateGradInput)(
80  THNNState *state, // library's state
81  THTensor *input, // input tensor
82  THTensor *gradOutput, // gradient w.r.t module's output
83  THTensor *gradInput, // [OUT] gradient w.r.t input
84  int dim); // dimension for halving operation
85 
86 // HardTanh clamps the values to the interval [min_val; max_val].
87 TH_API void THNN_(HardTanh_updateOutput)(
88  THNNState *state, // library's state
89  THTensor *input, // input tensor
90  THTensor *output, // [OUT] output tensor
91  accreal min_val, // lower threshold
92  accreal max_val, // upper threshold
93  bool inplace);
94 TH_API void THNN_(HardTanh_updateGradInput)(
95  THNNState *state, // library's state
96  THTensor *input, // input tensor
97  THTensor *gradOutput, // gradient w.r.t. module's output
98  THTensor *gradInput, // [OUT] gradient w.r.t. the input
99  accreal min_val, // lower threshold
100  accreal max_val, // upper threshold
101  bool inplace);
102 
103 TH_API void THNN_(Im2Col_updateOutput)(
104  THNNState *state,
105  THTensor *input,
106  THTensor *output,
107  int64_t kH, int64_t kW,
108  int64_t dilationH, int64_t dilationW,
109  int64_t padH, int64_t padW,
110  int64_t dH, int64_t dW);
111 
112 TH_API void THNN_(Im2Col_updateGradInput)(
113  THNNState *state,
114  THTensor *gradOutput,
115  THTensor *gradInput,
116  int64_t isizeH, int64_t isizeW,
117  int64_t kH, int64_t kW,
118  int64_t dilationH, int64_t dilationW,
119  int64_t padH, int64_t padW,
120  int64_t dH, int64_t dW);
121 
122 TH_API void THNN_(Col2Im_updateOutput)(
123  THNNState *state,
124  THTensor *input,
125  THTensor *output,
126  int64_t outputHeight, int64_t outputWidth,
127  int64_t kH, int64_t kW,
128  int64_t dilationH, int64_t dilationW,
129  int64_t padH, int64_t padW,
130  int64_t dH, int64_t dW);
131 
132 TH_API void THNN_(Col2Im_updateGradInput)(
133  THNNState *state,
134  THTensor *gradOutput,
135  THTensor *gradInput,
136  int64_t kH, int64_t kW,
137  int64_t dilationH, int64_t dilationW,
138  int64_t padH, int64_t padW,
139  int64_t dH, int64_t dW);
140 
141 TH_API void THNN_(LeakyReLU_updateOutput)(
142  THNNState *state, // library's state
143  THTensor *input, // [MODIFIED] input tensor
144  THTensor *output, // [OUT] output tensor
145  accreal negval, // negative part slope
146  bool inplace); // if true, modifies the input tensor and sets the output tensor on it (no additional memory is allocated)
147 TH_API void THNN_(LeakyReLU_updateGradInput)(
148  THNNState *state, // library's state
149  THTensor *input, // input tensor
150  THTensor *gradOutput, // [MODIFIED] gradient w.r.t. module's output
151  THTensor *gradInput, // [OUT] gradient w.r.t. the input
152  accreal negval, // negative part slope
153  bool inplace); // if true, modifies gradOutput and sets gradInput onto it (no additional memory is allocated)
154 
155 TH_API void THNN_(LogSigmoid_updateOutput)(
156  THNNState *state, // library's state
157  THTensor *input, // input tensor
158  THTensor *output, // output tensor
159  THTensor *buffer); // [BUFFER]
160 TH_API void THNN_(LogSigmoid_updateGradInput)(
161  THNNState *state, // library's state
162  THTensor *input, // input
163  THTensor *gradOutput, // gradient w.r.t. module's output
164  THTensor *gradInput, // [OUT] gradient w.r.t. input
165  THTensor *buffer); // [BUFFER]
166 
167 TH_API void THNN_(SoftMarginCriterion_updateOutput)(
168  THNNState *state,
169  THTensor *input,
170  THTensor *target,
171  THTensor *output,
172  int64_t reduction);
173 
174 TH_API void THNN_(SoftMarginCriterion_updateGradInput)(
175  THNNState *state,
176  THTensor *input,
177  THTensor *target,
178  THTensor *gradOutput,
179  THTensor *gradInput,
180  int64_t reduction);
181 
182 TH_API void THNN_(MSECriterion_updateOutput)(
183  THNNState *state,
184  THTensor *input,
185  THTensor *target,
186  THTensor *output,
187  int64_t reduction);
188 TH_API void THNN_(MSECriterion_updateGradInput)(
189  THNNState *state,
190  THTensor *input,
191  THTensor *target,
192  THTensor *gradOutput,
193  THTensor *gradInput,
194  int64_t reduction);
195 
196 TH_API void THNN_(MultiLabelMarginCriterion_updateOutput)(
197  THNNState *state,
198  THTensor *input,
199  THIndexTensor *target,
200  THTensor *output,
201  THTensor *isTarget,
202  int64_t reduction);
203 TH_API void THNN_(MultiLabelMarginCriterion_updateGradInput)(
204  THNNState *state,
205  THTensor *input,
206  THIndexTensor *target,
207  THTensor *gradOutput,
208  THTensor *gradInput,
209  THTensor *isTarget,
210  int64_t reduction);
211 
212 TH_API void THNN_(MultiMarginCriterion_updateOutput)(
213  THNNState *state,
214  THTensor *input,
215  THIndexTensor *target,
216  THTensor *output,
217  int64_t reduction,
218  int p,
219  THTensor* weights, // [OPTIONAL]
220  accreal margin);
221 TH_API void THNN_(MultiMarginCriterion_updateGradInput)(
222  THNNState *state,
223  THTensor *input,
224  THIndexTensor *target,
225  THTensor *gradOutput,
226  THTensor *gradInput,
227  int64_t reduction,
228  int p,
229  THTensor *weights, // [OPTIONAL]
230  accreal margin);
231 
232 TH_API void THNN_(RReLU_updateOutput)(
233  THNNState *state,
234  THTensor *input,
235  THTensor *output,
236  THTensor *noise,
237  accreal lower,
238  accreal upper,
239  bool train,
240  bool inplace,
241  THGenerator *generator);
242 TH_API void THNN_(RReLU_updateGradInput)(
243  THNNState *state,
244  THTensor *input,
245  THTensor *gradOutput,
246  THTensor *gradInput,
247  THTensor *noise,
248  accreal lower,
249  accreal upper,
250  bool train,
251  bool inplace);
252 
253 TH_API void THNN_(Sigmoid_updateOutput)(
254  THNNState *state,
255  THTensor *input,
256  THTensor *output);
257 TH_API void THNN_(Sigmoid_updateGradInput)(
258  THNNState *state,
259  THTensor *gradOutput,
260  THTensor *gradInput,
261  THTensor *output);
262 
263 TH_API void THNN_(SmoothL1Criterion_updateOutput)(
264  THNNState *state,
265  THTensor *input,
266  THTensor *target,
267  THTensor *output,
268  int64_t reduction);
269 TH_API void THNN_(SmoothL1Criterion_updateGradInput)(
270  THNNState *state,
271  THTensor *input,
272  THTensor *target,
273  THTensor *gradOutput,
274  THTensor *gradInput,
275  int64_t reduction);
276 
277 TH_API void THNN_(SoftPlus_updateOutput)(
278  THNNState *state,
279  THTensor *input, THTensor *output,
280  accreal beta,
281  accreal threshold);
282 TH_API void THNN_(SoftPlus_updateGradInput)(
283  THNNState *state,
284  THTensor *input,
285  THTensor *gradOutput,
286  THTensor *gradInput,
287  THTensor *output,
288  accreal beta,
289  accreal threshold);
290 
291 TH_API void THNN_(SoftShrink_updateOutput)(
292  THNNState *state,
293  THTensor *input,
294  THTensor *output,
295  accreal lambda);
296 TH_API void THNN_(SoftShrink_updateGradInput)(
297  THNNState *state,
298  THTensor *input,
299  THTensor *gradOutput,
300  THTensor *gradInput,
301  accreal lambda);
302 
303 
304 TH_API void THNN_(IndexLinear_updateOutput)(
305  THNNState *state,
306  THIndexTensor *keys,
307  int64_t keysOffset,
308  THTensor *values,
309  THIndexTensor *sizes,
310  THIndexTensor *cumSumSizes,
311  THTensor *output,
312  THTensor *weight,
313  THTensor *bias,
314  THTensor *normalizedValues,
315  int train);
316 TH_API void THNN_(IndexLinear_accGradParameters)(
317  THNNState *state,
318  THIndexTensor *keys,
319  int64_t keysOffset,
320  THTensor *values,
321  THIndexTensor *sizes,
322  THIndexTensor *cumSumSizes,
323  THTensor *gradOutput,
324  THTensor *gradWeight,
325  THTensor *gradBias,
326  THTensor *weight,
327  THTensor *bias,
328  THTensor* valuesBuffer,
329  accreal weightDecay,
330  accreal scale);
331 TH_API void THNN_(IndexLinear_accUpdateGradParameters)(
332  THNNState *state,
333  THIndexTensor *keys,
334  int64_t keysOffset,
335  THTensor *values,
336  THIndexTensor *sizes,
337  THIndexTensor *cumSumSizes,
338  THTensor *gradOutput,
339  THTensor *weight,
340  THTensor *bias,
341  accreal weightDecay,
342  accreal scale);
343 TH_API void THNN_(IndexLinear_updateParameters)(
344  THNNState *state,
345  THTensor *gradWeight,
346  THTensor *gradBias,
347  THTensor *weight,
348  THTensor *bias,
349  THIndexTensor *runningKeys,
350  THIndexTensor *cumSumSizes,
351  int64_t keysOffset,
352  accreal weightDecay,
353  accreal learningRate);
354 
355 TH_API void THNN_(TemporalRowConvolution_updateOutput)(
356  THNNState *state,
357  THTensor *input,
358  THTensor *output,
359  THTensor *weight,
360  THTensor *bias,
361  THTensor *finput,
362  THTensor *fgradInput,
363  int kW,
364  int dW,
365  int padW,
366  bool featFirst);
367 TH_API void THNN_(TemporalRowConvolution_updateGradInput)(
368  THNNState *state,
369  THTensor *input,
370  THTensor *gradOutput,
371  THTensor *gradInput,
372  THTensor *weight,
373  THTensor *finput,
374  THTensor *fgradInput,
375  int kW,
376  int dW,
377  int padW,
378  bool featFirst);
379 TH_API void THNN_(TemporalRowConvolution_accGradParameters)(
380  THNNState *state,
381  THTensor *input,
382  THTensor *gradOutput,
383  THTensor *gradWeight,
384  THTensor *gradBias,
385  THTensor *finput,
386  THTensor *fgradInput,
387  int kW,
388  int dW,
389  int padW,
390  bool featFirst,
391  accreal scale);
392 
393 TH_API void THNN_(TemporalUpSamplingNearest_updateOutput)(
394  THNNState *state,
395  THTensor *input,
396  THTensor *output,
397  int osizeW);
398 TH_API void THNN_(TemporalUpSamplingNearest_updateGradInput)(
399  THNNState *state,
400  THTensor *gradOutput,
401  THTensor *gradInput,
402  int isizeB,
403  int isizeC,
404  int isizeW,
405  int osizeW);
406 
407 TH_API void THNN_(TemporalUpSamplingLinear_updateOutput)(
408  THNNState *state,
409  THTensor *input,
410  THTensor *output,
411  int osizeW,
412  bool align_corners);
413 TH_API void THNN_(TemporalUpSamplingLinear_updateGradInput)(
414  THNNState *state,
415  THTensor *gradOutput,
416  THTensor *gradInput,
417  int isizeB,
418  int isizeC,
419  int isizeW,
420  int osizeW,
421  bool align_corners);
422 
423 TH_API void THNN_(SpatialConvolutionMM_updateOutput)(
424  THNNState *state,
425  THTensor *input,
426  THTensor *output,
427  THTensor *weight,
428  THTensor *bias, // [OPTIONAL]
429  THTensor *finput,
430  THTensor *fgradInput,
431  int kW, int kH,
432  int dW, int dH,
433  int padW, int padH);
434 TH_API void THNN_(SpatialConvolutionMM_updateGradInput)(
435  THNNState *state,
436  THTensor *input,
437  THTensor *gradOutput,
438  THTensor *gradInput,
439  THTensor *weight,
440  THTensor *finput,
441  THTensor *fgradInput,
442  int kW, int kH,
443  int dW, int dH,
444  int padW, int padH);
445 TH_API void THNN_(SpatialConvolutionMM_accGradParameters)(
446  THNNState *state,
447  THTensor *input,
448  THTensor *gradOutput,
449  THTensor *gradWeight,
450  THTensor *gradBias, // [OPTIONAL]
451  THTensor *finput,
452  THTensor *fgradInput,
453  int kW, int kH,
454  int dW, int dH,
455  int padW, int padH,
456  accreal scale);
457 
458 TH_API void THNN_(SpatialAdaptiveMaxPooling_updateOutput)(
459  THNNState *state,
460  THTensor *input,
461  THTensor *output,
462  THIndexTensor *indices,
463  int osizeW, int osizeH);
464 TH_API void THNN_(SpatialAdaptiveMaxPooling_updateGradInput)(
465  THNNState *state,
466  THTensor *input,
467  THTensor *gradOutput,
468  THTensor *gradInput,
469  THIndexTensor *indices);
470 
471 TH_API void THNN_(SpatialAveragePooling_updateOutput)(
472  THNNState *state,
473  THTensor *input,
474  THTensor *output,
475  int kW, int kH,
476  int dW, int dH,
477  int padW, int padH,
478  bool ceil_mode,
479  bool count_include_pad);
480 TH_API void THNN_(SpatialAveragePooling_updateGradInput)(
481  THNNState *state,
482  THTensor *input,
483  THTensor *gradOutput,
484  THTensor *gradInput,
485  int kW, int kH,
486  int dW, int dH,
487  int padW, int padH,
488  bool ceil_mode,
489  bool count_include_pad);
490 
491 TH_API void THNN_(SpatialDilatedConvolution_updateOutput)(
492  THNNState *state,
493  THTensor *input,
494  THTensor *output,
495  THTensor *weight,
496  THTensor *bias, // [OPTIONAL]
497  THTensor *columns,
498  THTensor *ones,
499  int kW, int kH,
500  int dW, int dH,
501  int padW, int padH,
502  int dilationW, int dilationH);
503 
504 TH_API void THNN_(SpatialDilatedConvolution_updateGradInput)(
505  THNNState *state,
506  THTensor *input,
507  THTensor *gradOutput,
508  THTensor *gradInput,
509  THTensor *weight,
510  THTensor *columns,
511  int kW, int kH,
512  int dW, int dH,
513  int padW, int padH,
514  int dilationW, int dilationH);
515 
516 TH_API void THNN_(SpatialDilatedConvolution_accGradParameters)(
517  THNNState *state,
518  THTensor *input,
519  THTensor *gradOutput,
520  THTensor *gradWeight,
521  THTensor *gradBias, // [OPTIONAL]
522  THTensor *columns,
523  THTensor *ones,
524  int kW, int kH,
525  int dW, int dH,
526  int padW, int padH,
527  int dilationW, int dilationH,
528  accreal scale);
529 
530 TH_API void THNN_(SpatialFullDilatedConvolution_updateOutput)(
531  THNNState *state,
532  THTensor *input,
533  THTensor *output,
534  THTensor *weight,
535  THTensor *bias, // [OPTIONAL]
536  THTensor *columns,
537  THTensor *ones,
538  int kW, int kH,
539  int dW, int dH,
540  int padW, int padH,
541  int dilationW, int dilationH,
542  int adjW, int adjH);
543 
544 TH_API void THNN_(SpatialFullDilatedConvolution_updateGradInput)(
545  THNNState *state,
546  THTensor *input,
547  THTensor *gradOutput,
548  THTensor *gradInput,
549  THTensor *weight,
550  THTensor *columns,
551  int kW, int kH,
552  int dW, int dH,
553  int padW, int padH,
554  int dilationW, int dilationH,
555  int adjW, int adjH);
556 
557 TH_API void THNN_(SpatialFullDilatedConvolution_accGradParameters)(
558  THNNState *state,
559  THTensor *input,
560  THTensor *gradOutput,
561  THTensor *gradWeight,
562  THTensor *gradBias, // [OPTIONAL]
563  THTensor *columns,
564  THTensor *ones,
565  int kW, int kH,
566  int dW, int dH,
567  int padW, int padH,
568  int dilationW, int dilationH,
569  int adjW, int adjH,
570  accreal scale);
571 
572 TH_API void THNN_(SpatialDilatedMaxPooling_updateOutput)(
573  THNNState *state,
574  THTensor *input,
575  THTensor *output,
576  THIndexTensor *indices,
577  int kW, int kH,
578  int dW, int dH,
579  int padW, int padH,
580  int dilationW, int dilationH,
581  bool ceil_mode);
582 TH_API void THNN_(SpatialDilatedMaxPooling_updateGradInput)(
583  THNNState *state,
584  THTensor *input,
585  THTensor *gradOutput,
586  THTensor *gradInput,
587  THIndexTensor *indices,
588  int kW, int kH,
589  int dW, int dH,
590  int padW, int padH,
591  int dilationW, int dilationH,
592  bool ceil_mode);
593 
594 TH_API void THNN_(SpatialMaxUnpooling_updateOutput)(
595  THNNState *state,
596  THTensor *input,
597  THTensor *output,
598  THIndexTensor *indices,
599  int owidth, int oheight);
600 TH_API void THNN_(SpatialMaxUnpooling_updateGradInput)(
601  THNNState *state,
602  THTensor *input,
603  THTensor *gradOutput,
604  THTensor *gradInput,
605  THIndexTensor *indices,
606  int owidth, int oheight);
607 
608 TH_API void THNN_(SpatialUpSamplingNearest_updateOutput)(
609  THNNState *state,
610  THTensor *input,
611  THTensor *output,
612  int osizeH,
613  int osizeW);
614 
615 TH_API void THNN_(SpatialUpSamplingNearest_updateGradInput)(
616  THNNState *state,
617  THTensor *gradOutput,
618  THTensor *gradInput,
619  int isizeB,
620  int isizeC,
621  int isizeH,
622  int isizeW,
623  int osizeH,
624  int osizeW);
625 
626 TH_API void THNN_(SpatialUpSamplingBilinear_updateOutput)(
627  THNNState *state,
628  THTensor *input,
629  THTensor *output,
630  int osizeH,
631  int osizeW,
632  bool align_corners);
633 
634 TH_API void THNN_(SpatialUpSamplingBilinear_updateGradInput)(
635  THNNState *state,
636  THTensor *gradOutput,
637  THTensor *gradInput,
638  int isizeB,
639  int isizeC,
640  int isizeH,
641  int isizeW,
642  int osizeH,
643  int osizeW,
644  bool align_corners);
645 
646 TH_API void THNN_(SpatialUpSamplingBicubic_updateOutput)(
647  THNNState *state,
648  THTensor *input,
649  THTensor *output,
650  int osizeH,
651  int osizeW,
652  bool align_corners);
653 
654 TH_API void THNN_(SpatialUpSamplingBicubic_updateGradInput)(
655  THNNState *state,
656  THTensor *gradOutput,
657  THTensor *gradInput,
658  int isizeB,
659  int isizeC,
660  int isizeH,
661  int isizeW,
662  int osizeH,
663  int osizeW,
664  bool align_corners);
665 
666 TH_API void THNN_(unfolded_acc)(
667  THTensor *finput,
668  THTensor *input,
669  int kW, int kH,
670  int dW, int dH,
671  int padW, int padH,
672  int nInputPlane,
673  int inputWidth, int inputHeight,
674  int osizeW, int outputHeight);
675 TH_API void THNN_(unfolded_copy)(
676  THTensor *finput,
677  THTensor *input,
678  int kW, int kH,
679  int dW, int dH,
680  int padW, int padH,
681  int nInputPlane,
682  int inputWidth, int inputHeight,
683  int outputWidth, int outputHeight);
684 
685 TH_API void THNN_(VolumetricAveragePooling_updateOutput)(
686  THNNState *state,
687  THTensor *input,
688  THTensor *output,
689  int kT, int kW, int kH,
690  int dT, int dW, int dH,
691  int padT, int padW, int padH,
692  bool ceil_mode, bool count_include_pad);
693 TH_API void THNN_(VolumetricAveragePooling_updateGradInput)(
694  THNNState *state,
695  THTensor *input,
696  THTensor *gradOutput,
697  THTensor *gradInput,
698  int kT, int kW, int kH,
699  int dT, int dW, int dH,
700  int padT, int padW, int padH,
701  bool ceil_mode, bool count_include_pad);
702 
703 TH_API void THNN_(VolumetricDilatedConvolution_updateOutput)(
704  THNNState *state,
705  THTensor *input,
706  THTensor *output,
707  THTensor *weight,
708  THTensor *bias, // [OPTIONAL]
709  THTensor *columns,
710  THTensor *ones,
711  int kT, int kW, int kH,
712  int dT, int dW, int dH,
713  int padT, int padW, int padH,
714  int dilationT, int dilationW, int dilationH);
715 
716 TH_API void THNN_(VolumetricDilatedConvolution_updateGradInput)(
717  THNNState *state,
718  THTensor *input,
719  THTensor *gradOutput,
720  THTensor *gradInput,
721  THTensor *weight,
722  THTensor *columns,
723  int kT, int kW, int kH,
724  int dT, int dW, int dH,
725  int padT, int padW, int padH,
726  int dilationT, int dilationW, int dilationH);
727 
728 TH_API void THNN_(VolumetricDilatedConvolution_accGradParameters)(
729  THNNState *state,
730  THTensor *input,
731  THTensor *gradOutput,
732  THTensor *gradWeight,
733  THTensor *gradBias, // [OPTIONAL]
734  THTensor *columns,
735  THTensor *ones,
736  int kT, int kW, int kH,
737  int dT, int dW, int dH,
738  int padT, int padW, int padH,
739  int dilationT, int dilationW, int dilationH,
740  accreal scale);
741 
742 TH_API void THNN_(VolumetricFullDilatedConvolution_updateOutput)(
743  THNNState *state, // library state
744  THTensor *input, // 4D or 5D (batch) tensor
745  THTensor *output, // [OUT] volumetric convolution output
746  THTensor *weight, // weight tensor (nInputPlane x nOutputPlane x kT x kH x kW)
747  THTensor *bias, // [OPTIONAL] gradBias tensor (nOutputPlane)
748  THTensor *finput, // [OUT] internal columns buffer
749  THTensor *fgradInput, // [OUT] internal ones buffer
750  int kT, int kW, int kH, // kernel size
751  int dT, int dW, int dH, // stride of the convolution
752  int pT, int pW, int pH, // padding
753  int dilationT, int dilationW, int dilationH,
754  int aT, int aW, int aH); // extra output adjustment
755 TH_API void THNN_(VolumetricFullDilatedConvolution_updateGradInput)(
756  THNNState *state, // library state
757  THTensor *input, // 4D or 5D (batch) tensor
758  THTensor *gradOutput, // gradient w.r.t. output
759  THTensor *gradInput, // [OUT] gradient w.r.t. input
760  THTensor *weight, // weight tensor (nInputPlane x nOutputPlane x kT x kH x kW)
761  THTensor *finput, // internal columns buffer
762  THTensor *fgradInput, // internal ones buffer
763  int kT, int kW, int kH, // kernel size
764  int dT, int dW, int dH, // stride
765  int pT, int pW, int pH, // padding
766  int dilationT, int dilationW, int dilationH,
767  int aT, int aW, int aH); // extra output adjustment
768 
769 TH_API void THNN_(VolumetricFullDilatedConvolution_accGradParameters)(
770  THNNState *state, // library state
771  THTensor *input, // 4D or 5D (batch) tensor
772  THTensor *gradOutput, // gradient w.r.t. output
773  THTensor *gradWeight, // gradWeight tensor (nInputPlane x nOutputPlane x kT x kH x kW)
774  THTensor *gradBias, // [OPTIONAL] gradBias tensor (nOutputPlane)
775  THTensor *finput, // internal columns buffer
776  THTensor *fgradInput, // internal ones buffer
777  int kT, int kW, int kH, // kernel size
778  int dT, int dW, int dH, // stride
779  int pT, int pW, int pH, // padding
780  int dilationT, int dilationW, int dilationH,
781  int aT, int aW, int aH, // extra output adjustment
782  accreal scale); // scaling factor
783 
784 TH_API void THNN_(VolumetricDilatedMaxPooling_updateOutput)(
785  THNNState *state,
786  THTensor *input,
787  THTensor *output,
788  THIndexTensor *indices,
789  int kT, int kW, int kH,
790  int dT, int dW, int dH,
791  int pT, int pW, int pH,
792  int dilationT, int dilationW, int dilationH,
793  bool ceilMode);
794 TH_API void THNN_(VolumetricDilatedMaxPooling_updateGradInput)(
795  THNNState *state,
796  THTensor *input,
797  THTensor *gradOutput,
798  THTensor *gradInput,
799  THIndexTensor *indices,
800  int kT, int kW, int kH,
801  int dT, int dW, int dH,
802  int pT, int pW, int pH,
803  int dilationT, int dilationW, int dilationH,
804  bool ceilMode);
805 
806 TH_API void THNN_(VolumetricMaxUnpooling_updateOutput)(
807  THNNState *state,
808  THTensor *input,
809  THTensor *output,
810  THIndexTensor *indices,
811  int oT, int oW, int oH,
812  int dT, int dW, int dH,
813  int pT, int pW, int pH);
814 TH_API void THNN_(VolumetricMaxUnpooling_updateGradInput)(
815  THNNState *state,
816  THTensor *input,
817  THTensor *gradOutput,
818  THTensor *gradInput,
819  THIndexTensor *indices,
820  int oT, int oW, int oH,
821  int dT, int dW, int dH,
822  int pT, int pW, int pH);
823 
824 TH_API void THNN_(VolumetricAdaptiveAveragePooling_updateOutput)(
825  THNNState *state,
826  THTensor *input,
827  THTensor *output,
828  int osizeT,
829  int osizeW,
830  int osizeH);
831 TH_API void THNN_(VolumetricAdaptiveAveragePooling_updateGradInput)(
832  THNNState *state,
833  THTensor *input,
834  THTensor *gradOutput,
835  THTensor *gradInput);
836 
837 TH_API void THNN_(VolumetricAdaptiveMaxPooling_updateOutput)(
838  THNNState *state,
839  THTensor *input,
840  THTensor *output,
841  THIndexTensor *indices,
842  int osizeT, int osizeW, int osizeH);
843 TH_API void THNN_(VolumetricAdaptiveMaxPooling_updateGradInput)(
844  THNNState *state,
845  THTensor *input,
846  THTensor *gradOutput,
847  THTensor *gradInput,
848  THIndexTensor *indices);
849 
850 TH_API void THNN_(FeatureLPPooling_updateOutput)(
851  THNNState *state,
852  THTensor *input,
853  THTensor *output,
854  accreal power,
855  int width,
856  int stride,
857  bool batchMode);
858 
859 TH_API void THNN_(FeatureLPPooling_updateGradInput)(
860  THNNState *state,
861  THTensor* gradOutput,
862  THTensor* input,
863  THTensor* output,
864  THTensor* gradInput,
865  accreal power,
866  int width,
867  int stride,
868  bool batchMode);
869 
870 TH_API void THNN_(VolumetricUpSamplingNearest_updateOutput)(
871  THNNState *state,
872  THTensor *input,
873  THTensor *output,
874  int osizeT,
875  int osizeH,
876  int osizeW);
877 
878 TH_API void THNN_(VolumetricUpSamplingNearest_updateGradInput)(
879  THNNState *state,
880  THTensor *gradOutput,
881  THTensor *gradInput,
882  int isizeB,
883  int isizeC,
884  int isizeT,
885  int isizeH,
886  int isizeW,
887  int osizeT,
888  int osizeH,
889  int osizeW);
890 
891 TH_API void THNN_(VolumetricUpSamplingTrilinear_updateOutput)(
892  THNNState *state,
893  THTensor *input,
894  THTensor *output,
895  int osizeT,
896  int osizeH,
897  int osizeW,
898  bool align_corners);
899 
900 TH_API void THNN_(VolumetricUpSamplingTrilinear_updateGradInput)(
901  THNNState *state,
902  THTensor *gradOutput,
903  THTensor *gradInput,
904  int isizeB,
905  int isizeC,
906  int isizeT,
907  int isizeH,
908  int isizeW,
909  int osizeT,
910  int osizeH,
911  int osizeW,
912  bool align_corners);
913 
914 TH_API void THNN_(Tanh_updateOutput)(
915  THNNState *state,
916  THTensor *input,
917  THTensor *output);
918 TH_API void THNN_(Tanh_updateGradInput)(
919  THNNState *state,
920  THTensor *gradOutput,
921  THTensor *gradInput,
922  THTensor *output);
923 
924 TH_API void THNN_(VolumetricConvolutionMM_updateOutput)(
925  THNNState *state,
926  THTensor *input,
927  THTensor *output,
928  THTensor *weight,
929  THTensor *bias, // [OPTIONAL]
930  THTensor *finput,
931  THTensor *fgradInput, // HACK to make signature line up with backward
932  int kT, int kW, int kH,
933  int dT, int dW, int dH,
934  int pT, int pW, int pH);
935 TH_API void THNN_(VolumetricConvolutionMM_updateGradInput)(
936  THNNState *state,
937  THTensor *input,
938  THTensor *gradOutput,
939  THTensor *gradInput,
940  THTensor *weight,
941  THTensor *finput,
942  THTensor *fgradInput,
943  int kT, int kW, int kH,
944  int dT, int dW, int dH,
945  int pT, int pW, int pH);
946 TH_API void THNN_(VolumetricConvolutionMM_accGradParameters)(
947  THNNState *state,
948  THTensor *input,
949  THTensor *gradOutput,
950  THTensor *gradWeight,
951  THTensor *gradBias, // [OPTIONAL]
952  THTensor *finput,
953  THTensor *fgradInput,
954  int kT, int kW, int kH,
955  int dT, int dW, int dH,
956  int pT, int pW, int pH,
957  accreal scale);
958 
959 TH_API void THNN_(SpatialClassNLLCriterion_updateOutput)(
960  THNNState *state, // library's state
961  THTensor *input, // input tensor (4D)
962  THIndexTensor *target, // tensor containing indexes of target classes (3D)
963  THTensor *output, // [OUT] a one-element tensor with loss
964  int64_t reduction,
965  THTensor *weights, // [OPTIONAL] class weights
966  THTensor *total_weight, // [BUFFER]
967  int64_t ignore_index); // target index to ignore (loss = 0, gradInput = 0)
968 
969 TH_API void THNN_(SpatialClassNLLCriterion_updateGradInput)(
970  THNNState *state, // library's state
971  THTensor *input, // input tensor (4D)
972  THIndexTensor *target, // tensor containing indexes of target classes (3D)
973  THTensor *gradOutput,
974  THTensor *gradInput, // [OUT] gradient w.r.t. input
975  int64_t reduction,
976  THTensor *weights, // [OPTIONAL] class weights
977  THTensor *total_weight, // [BUFFER]
978  int64_t ignore_index); // target index to ignore (loss = 0, gradInput = 0)
979 
980 
981 #endif