Skip to content

albanD/c-in-lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

c in lua

This repo presents a simple example on how to embed c code in lua/torch.

To do so we will present how to create a new Torch layer that will just multiply the input by a constant. This repository contains 3 different implementation:

  • luaModule shows how to create the module with only lua code.
  • cModule shows how to create the module with some functions implemented in C. Here C functions are implemented for a fixed tensor type.
  • cGenericModule shows how to create the module with some functions implemented in C. Here we use the macro tricks fom TH to generate the functions for all needed types (Float and Double).

It also contains test.lua that is a simple example that will load the custom module and try to use it with both FloatTensor and DoubleTensor and verify that the outputs are correct.

About

Basic way to embed C code in lua for Torch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages