libeblearn
/home/rex/ebltrunk/core/libeblearn/include/ebl_lua.h
00001 /***************************************************************************
00002  *   Copyright (C) 2011 by Pierre Sermanet *
00003  *   pierre.sermanet@gmail.com *
00004  *   All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions are met:
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Redistribution under a license not approved by the Open Source
00014  *       Initiative (http://www.opensource.org) must display the
00015  *       following acknowledgement in all advertising material:
00016  *        This product includes software developed at the Courant
00017  *        Institute of Mathematical Sciences (http://cims.nyu.edu).
00018  *     * The names of the authors may not be used to endorse or promote products
00019  *       derived from this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
00022  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00023  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00024  * DISCLAIMED. IN NO EVENT SHALL ThE AUTHORS BE LIABLE FOR ANY
00025  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00026  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00027  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00028  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  ***************************************************************************/
00032 
00033 #ifndef EBL_LUA_H_
00034 #define EBL_LUA_H_
00035 
00036 #include "ebl_defines.h"
00037 #include "libidx.h"
00038 #include "ebl_arch.h"
00039 #include "ebl_states.h"
00040 #include "ebl_utils.h"
00041 #include "ebl_preprocessing.h"
00042 
00043 namespace ebl {
00044 
00046   // lua_module
00048   template <typename T, class Tstate = bbstate_idx<T> >
00049     class lua_module: public module_1_1<T, Tstate> {
00050   public:
00052     lua_module(const char *script, const char *name = "lua");
00054     virtual ~lua_module();
00056     virtual void fprop(mstate<Tstate> &in, mstate<Tstate> &out);
00058     virtual void bprop(mstate<Tstate> &in, mstate<Tstate> &out);
00060     virtual void bbprop(mstate<Tstate> &in, mstate<Tstate> &out);
00062     virtual std::string describe();
00063 
00064     // members ////////////////////////////////////////////////////////
00065   protected:
00066     string script_fname;
00067     long ninputs;
00068     float **inputs;
00069     long **inputs_size;
00070 
00071     long noutputs;
00072     float **outputs;
00073     long **outputs_size;
00074   };
00075   
00076 } // namespace ebl {
00077 
00078 #include "ebl_lua.hpp"
00079 
00080 #endif /* EBL_LUA_H_ */