Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/nn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Köpf <andreas.koepf@xamla.com>2015-12-12 01:47:10 +0300
committersoumith <soumith@gmail.com>2015-12-30 00:38:06 +0300
commitad1efeed343a6f82593a15e78ea7e7bd6ceb041c (patch)
treeda68f51f86f3d570c9c233dab642941aba16e439 /generic/Abs.c
parenta4b99ea770b38362dd376544aa4b8dffc5bd89cb (diff)
Add THNN/ffi conversion of Abs
Diffstat (limited to 'generic/Abs.c')
-rw-r--r--generic/Abs.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/generic/Abs.c b/generic/Abs.c
deleted file mode 100644
index 0d258f8..0000000
--- a/generic/Abs.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef TH_GENERIC_FILE
-#define TH_GENERIC_FILE "generic/Abs.c"
-#else
-
-static int nn_(Abs_updateOutput)(lua_State *L)
-{
- THTensor *input = luaT_checkudata(L, 2, torch_Tensor);
- THTensor *output = luaT_getfieldcheckudata(L, 1, "output", torch_Tensor);
-
- THTensor_(resizeAs)(output, input);
- THTensor_(abs)(output, input);
- return 1;
-}
-
-static int nn_(Abs_updateGradInput)(lua_State *L)
-{
- THTensor *input = luaT_checkudata(L, 2, torch_Tensor);
- THTensor *gradOutput = luaT_checkudata(L, 3, torch_Tensor);
- THTensor *gradInput = luaT_getfieldcheckudata(L, 1, "gradInput", torch_Tensor);
-
- THTensor_(resizeAs)(gradInput, input);
- TH_TENSOR_APPLY3(real, gradInput, real, gradOutput, real, input, \
- real z = *input_data; \
- *gradInput_data = *gradOutput_data * (z >= 0 ? 1 : -1);)
- return 1;
-}
-
-static const struct luaL_Reg nn_(Abs__) [] = {
- {"Abs_updateOutput", nn_(Abs_updateOutput)},
- {"Abs_updateGradInput", nn_(Abs_updateGradInput)},
- {NULL, NULL}
-};
-
-static void nn_(Abs_init)(lua_State *L)
-{
- luaT_pushmetatable(L, torch_Tensor);
- luaT_registeratname(L, nn_(Abs__), "nn");
- lua_pop(L,1);
-}
-
-#endif