-
Notifications
You must be signed in to change notification settings - Fork 14
/
init.cpp
40 lines (33 loc) · 839 Bytes
/
init.cpp
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
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <iostream>
#include <stdexcept>
using namespace std;
extern "C" {
#include "lua.h"
#include "utils.h"
}
#include "clnn_commit_generated.h"
extern "C" {
int luaopen_libclnn( lua_State *L );
}
static int clnn_about(lua_State *L)
{
cout << "clnn. OpenCL backend for Torch nn" << endl;
cout << "Built from commit " << clnn_commit << endl;
cout << "More info, doc: https://github.com/hughperkins/clnn" << endl;
cout << "Issues: https://github.com/hughperkins/clnn/issues" << endl;
return 0;
}
static const struct luaL_Reg clnn_stuff__ [] = {
{"about", clnn_about},
{NULL, NULL}
};
int luaopen_libclnn( lua_State *L ) {
try {
lua_newtable(L);
luaL_setfuncs(L, clnn_stuff__, 0);
} catch(runtime_error &e) {
THError("Something went wrong: %s", e.what());
}
return 1;
}