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

github.com/clementfarabet/lua---nnx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'init.c')
-rw-r--r--init.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/init.c b/init.c
new file mode 100644
index 0000000..8721306
--- /dev/null
+++ b/init.c
@@ -0,0 +1,23 @@
+#include "TH.h"
+#include "luaT.h"
+
+#define torch_(NAME) TH_CONCAT_3(torch_, Real, NAME)
+#define torch_string_(NAME) TH_CONCAT_STRING_3(torch., Real, NAME)
+#define nn_(NAME) TH_CONCAT_3(nn_, Real, NAME)
+
+static const void* torch_FloatTensor_id = NULL;
+static const void* torch_DoubleTensor_id = NULL;
+
+#include "generic/SpatialLinear.c"
+#include "THGenerateFloatTypes.h"
+
+DLL_EXPORT int luaopen_libnnx(lua_State *L)
+{
+ torch_FloatTensor_id = luaT_checktypename2id(L, "torch.FloatTensor");
+ torch_DoubleTensor_id = luaT_checktypename2id(L, "torch.DoubleTensor");
+
+ nn_FloatSpatialLinear_init(L);
+ nn_DoubleSpatialLinear_init(L);
+
+ return 1;
+}