8.1.4. Torch: Machine Learning

Author(s): Fu Jie Huang

This is a full interface to the machine learning library Torch3 (version 3.0 beta1) .

Informations about Torch3 are available at: http://www.torch.ch/ Installation

The Lush interface requires the library libtorch and associated header files. It's built and tested with version 3.0b1 .

Torch3 is only available in source code. To compile and install it under linux:

1. download and unpack the Torch3all.tgz file and change directory into it
2. type "cp ./config/Makefile_options_linux ./" 
3. modify the Makefile_options_linux:
       PACKAGES = convolutions datasets distributions 
                 gradients kernels matrix nonparametrics speech
4. type "make depend; make"
5. copy the library file ./lib/Linux_OPT_DOUBLE/libtorch.a to /usr/lib/
6. create directory /usr/include/torch/, and copy all the headerfiles to it:
        export torchdir=/usr/include/torch
         mkdir $torchdir; cp $(ls */*.h) $torchdir

The Makefile in Torch3 has an unsolved bug. When it generates the libtorch.a file, sometimes it does not archive the object files under the nonparametrics directory. Lush will complain when this happens. To solve it:

1. cd to ./objs/Linux_OPT_DOUBLE
(the compilation above put all the object files here)
2. type "g++ -shared *.o -o libtorch.so"
3. copy the library file libtorch.so to /usr/lib/
(replace the file in step 5 above)

Start Lush, and type:

? (libload "torch/torch")