| #ifndef TH_GENERIC_FILE |
| #define TH_GENERIC_FILE "generic/Sigmoid.c" |
| #else |
| |
| void THNN_(Sigmoid_updateOutput)( |
| THNNState *state, |
| THTensor *input, |
| THTensor *output) |
| { |
| THTensor_(sigmoid)(output, input); |
| } |
| |
| void THNN_(Sigmoid_updateGradInput)( |
| THNNState *state, |
| THTensor *input, |
| THTensor *gradOutput, |
| THTensor *gradInput, |
| THTensor *output) |
| { |
| THNN_CHECK_NELEMENT(output, gradOutput); |
| THTensor_(resizeAs)(gradInput, output); |
| TH_TENSOR_APPLY3(real, gradInput, real, gradOutput, real, output, |
| real z = *output_data; |
| *gradInput_data = *gradOutput_data * (1. - z) * z; |
| ); |
| } |
| |
| #endif |