forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Abs.cu
29 lines (25 loc) · 891 Bytes
/
Abs.cu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef THC_GENERIC_FILE
#define THC_GENERIC_FILE "THCUNN/generic/Abs.cu"
#else
#include <THCUNN/common.h>
void THNN_(Abs_updateOutput)(
THCState *state,
THCTensor *input,
THCTensor *output)
{
THCUNN_assertSameGPU(state, 2, input, output);
THCTensor_(resizeAs)(state, output, input);
THC_pointwiseApply2<scalar_t, scalar_t>(state, output, input, absupdateOutput_functor<scalar_t>());
}
void THNN_(Abs_updateGradInput)(
THCState *state,
THCTensor *input,
THCTensor *gradOutput,
THCTensor *gradInput)
{
THCUNN_check_nElement(state, input, gradOutput);
THCUNN_assertSameGPU(state, 3, input, gradOutput, gradInput);
THCTensor_(resizeAs)(state, gradInput, input);
THC_pointwiseApply3<scalar_t, scalar_t, scalar_t>(state, gradInput, input, gradOutput, absupdateGradInput_functor<scalar_t>());
}
#endif