Example #1
0
void nn_SpatialConvolution_init(lua_State *L)
{
  torch_Tensor_id = luaT_checktypename2id(L, "torch.Tensor");
  nn_SpatialConvolution_id = luaT_newmetatable(L, "nn.SpatialConvolution", NULL, NULL, NULL, NULL);
  luaL_register(L, NULL, nn_SpatialConvolution__);
  lua_pop(L, 1);
}
Example #2
0
void nn_LcEncoder_init(lua_State *L)
{
  torch_Tensor_id = luaT_checktypename2id(L, "torch.Tensor");
  nn_LcEncoder_id = luaT_newmetatable(L, "nn.LcEncoder", NULL, NULL, NULL, NULL);
  luaL_register(L, NULL, nn_LcEncoder__);
  lua_pop(L, 1);
}
Example #3
0
void torch_PipeFile_init(lua_State *L)
{
  luaT_newmetatable(L, "torch.PipeFile", "torch.DiskFile",
                    torch_PipeFile_new, torch_PipeFile_free, NULL);
  luaL_register(L, NULL, torch_PipeFile__);
  lua_pop(L, 1);
}
Example #4
0
void nn_TemporalSubSampling_init(lua_State *L)
{
  torch_Tensor_id = luaT_checktypename2id(L, "torch.Tensor");
  nn_TemporalSubSampling_id = luaT_newmetatable(L, "nn.TemporalSubSampling", NULL, NULL, NULL, NULL);
  luaL_register(L, NULL, nn_TemporalSubSampling__);
  lua_pop(L, 1);
}
Example #5
0
void torch_MemoryFile_init(lua_State *L)
{
  luaT_newmetatable(L, "torch.MemoryFile", "torch.File",
                    torch_MemoryFile_new, torch_MemoryFile_free, NULL);
  luaT_setfuncs(L, torch_MemoryFile__, 0);
  lua_pop(L, 1);
}
Example #6
0
void torch_MemoryFile_init(lua_State *L)
{
  luaT_newmetatable(L, "torch.MemoryFile", "torch.File",
                    torch_MemoryFile_new, torch_MemoryFile_free, NULL);
  luaL_register(L, NULL, torch_MemoryFile__);
  lua_pop(L, 1);
}
Example #7
0
void torch_Generator_init(lua_State *L)
{
  luaT_newmetatable(L, torch_Generator, NULL,
                    torch_Generator_new, torch_Generator_free, torch_Generator_factory);
  luaT_setfuncs(L, torch_Generator_table_, 0);
  lua_pop(L, 1);
}
Example #8
0
void nerv_matrix_init(lua_State *L) {
    /* abstract base class: Matrix */
    luaT_newmetatable(L, nerv_matrix_tname, NULL, NULL, NULL, NULL);
    luaL_register(L, NULL, matrix_methods);
    lua_pop(L, 1);

    /* CuMatrix inherits from Matrix */
    luaT_newmetatable(L, nerv_matrix_cuda_tname, nerv_matrix_tname,
                            NULL, NULL, NULL);
    nerv_lua_cumatrix_init(L);
    lua_pop(L, 1);
    /* MMatrix inherits from Matrix */
    luaT_newmetatable(L, nerv_matrix_host_tname, nerv_matrix_tname,
                            NULL, NULL, NULL);
    nerv_lua_mmatrix_init(L);
    lua_pop(L, 1);
}
Example #9
0
void nerv_matrix_(lua_init)(lua_State *L) {
    luaT_newmetatable(L, nerv_matrix_(tname), MATRIX_BASE_TNAME,
                        nerv_matrix_(lua_new), nerv_matrix_(lua_destroy), NULL);
    luaL_register(L, NULL, nerv_matrix_(methods));
#ifdef MATRIX_INIT
    MATRIX_INIT(L);
#endif
    lua_pop(L, 1);
}
Example #10
0
void torch_MemoryFile_init(lua_State *L)
{
  torch_CharStorage_id = luaT_checktypename2id(L, "torch.CharStorage");

  torch_MemoryFile_id = luaT_newmetatable(L, "torch.MemoryFile", "torch.File",
                                          torch_MemoryFile_new, torch_MemoryFile_free, NULL);

  luaL_register(L, NULL, torch_MemoryFile__);
  lua_pop(L, 1);
}
Example #11
0
extern "C" void svm_QPSolver_init(lua_State *L)
{
  torch_Tensor_id = luaT_checktypename2id(L, "torch.Tensor");
  torch_IntStorage_id = luaT_checktypename2id(L, "torch.IntStorage");

  QPSolver_id = luaT_newmetatable(L, "svm.QPSolver", NULL,
                                  QPSolver_new, QPSolver_free, NULL);
  
  luaL_register(L, NULL, QPSolver__);
  lua_pop(L, 1);
}
Example #12
0
File: lcairo.c Project: elq/torch5
void lcairo_init(lua_State *L)
{  
  globalL=L;
  luaL_register(L, NULL, lcairo__);

  /* external classes used */

  torch_Tensor_id = luaT_checktypename2id(L, "torch.Tensor");

  /* cairo */

  tCairo_id  =luaT_newmetatable(L, "lcairo.tCairo",   NULL, NULL, lcairo_cairo_destroy, NULL);

  /* surfaces */

  /* tSurface and tSurfaceData are only ever refeneces - no garbage collection */
  tSurface_id    =luaT_newmetatable(L, "lcairo.tSurface", NULL, NULL, NULL, NULL);
  tSurfaceData_id=luaT_newmetatable(L, "lcairo.tSurfaceData", NULL, NULL, NULL, NULL);

  tImage_id  =luaT_newmetatable(L, "lcairo.tImage",   NULL, NULL, lcairo_image_destroy, NULL);
  tWindow_id =luaT_newmetatable(L, "lcairo.tWindow",  NULL, NULL, lcairo_window_destroy, NULL);

  /* patterns */

  /* May need tPattern and tPatternCreated:child tPattern to differentiate for garbage */
  tPattern_id =luaT_newmetatable(L, "lcairo.tPattern",  NULL, NULL, NULL, NULL);

#ifdef LCAIRO_USE_READLINE
  rl_event_hook=readline_callback;
#endif /* LCAIRO_USE_READLINE */
}
Example #13
0
File: File.c Project: elq/torch5
void torch_File_init(lua_State *L)
{
  torch_CharStorage_id = luaT_checktypename2id(L, "torch.CharStorage");
  torch_ShortStorage_id = luaT_checktypename2id(L, "torch.ShortStorage");
  torch_IntStorage_id = luaT_checktypename2id(L, "torch.IntStorage");
  torch_LongStorage_id = luaT_checktypename2id(L, "torch.LongStorage");
  torch_FloatStorage_id = luaT_checktypename2id(L, "torch.FloatStorage");
  torch_DoubleStorage_id = luaT_checktypename2id(L, "torch.DoubleStorage");

  torch_File_id = luaT_newmetatable(L, "torch.File", NULL, NULL, NULL, NULL);
  luaL_register(L, NULL, torch_File__);
  lua_pop(L, 1);
}
Example #14
0
int luaopen_libtorch(lua_State *L)
{
  THSetErrorHandler(luaTorchErrorHandlerFunction, L);
  THSetArgErrorHandler(luaTorchArgErrorHandlerFunction, L);

  lua_newtable(L);
  lua_pushvalue(L, -1);
  lua_setglobal(L, "torch");

  torch_File_init(L);

  torch_ByteStorage_init(L);
  torch_CharStorage_init(L);
  torch_ShortStorage_init(L);
  torch_IntStorage_init(L);
  torch_LongStorage_init(L);
  torch_FloatStorage_init(L);
  torch_DoubleStorage_init(L);

  torch_ByteTensor_init(L);
  torch_CharTensor_init(L);
  torch_ShortTensor_init(L);
  torch_IntTensor_init(L);
  torch_LongTensor_init(L);
  torch_FloatTensor_init(L);
  torch_DoubleTensor_init(L);

  torch_ByteTensorOperator_init(L);
  torch_CharTensorOperator_init(L);
  torch_ShortTensorOperator_init(L);
  torch_IntTensorOperator_init(L);
  torch_LongTensorOperator_init(L);
  torch_FloatTensorOperator_init(L);
  torch_DoubleTensorOperator_init(L);

  torch_Timer_init(L);
  torch_DiskFile_init(L);
  torch_PipeFile_init(L);
  torch_MemoryFile_init(L);

  torch_TensorMath_init(L);

  torch_utils_init(L);
  torch_random_init(L);

  // Create 'torch.Allocator' type.
  luaT_newmetatable(L, "torch.Allocator", NULL, NULL, NULL, NULL);

  return 1;
}
Example #15
0
DLL_EXPORT int luaopen_libpa(lua_State *L)
{
  if(sizeof(short) != 2)
    luaL_error(L, "your platform has a strange size for short int type");

  if(sizeof(int) != 4)
    luaL_error(L, "your platform has a strange size for int type");

  if(sizeof(char) != 1)
    luaL_error(L, "your platform has a strange size for char type");

  if(sizeof(float) != 4)
    luaL_error(L, "your platform has a strange size for float type");

  lua_newtable(L);
  lua_pushvalue(L, -1);
  lua_setfield(L, LUA_GLOBALSINDEX, "pa");
  luaL_register(L, NULL, pa_global__);

  lua_newtable(L);
  lua_pushnumber(L, paFloat32);
  lua_setfield(L, -2, "float32");
  lua_pushnumber(L, paInt16);
  lua_setfield(L, -2, "int16");
  lua_pushnumber(L, paInt32);
  lua_setfield(L, -2, "int32");
  lua_pushnumber(L, paInt24);
  lua_setfield(L, -2, "int24");
  lua_pushnumber(L, paInt8);
  lua_setfield(L, -2, "int8");
  lua_pushnumber(L, paUInt8);
  lua_setfield(L, -2, "uint8");
  lua_pushnumber(L, paCustomFormat);
  lua_setfield(L, -2, "customformat");
  lua_pushnumber(L, paNonInterleaved);
  lua_setfield(L, -2, "noninterleaved");
  lua_setfield(L, -2, "format");

  luaT_newmetatable(L, "pa.Stream", NULL, NULL, pa_stream_free, NULL);
  luaL_register(L, NULL, pa_stream__);
  lua_pop(L, 1);

  pa_checkerror(L, Pa_Initialize());

  return 1;
}
Example #16
0
static void cutorch_Event_init(lua_State *L)
{
  luaT_newmetatable(L, "cutorch.Event", NULL, cutorch_Event_new, cutorch_Event_free, NULL);
  luaT_setfuncs(L, cutorch_Event__, 0);
  lua_pop(L, 1);
}