APRIL-ANN toolkit (A Pattern Recognizer In Lua with ANNs). This toolkit incorporates ANN algorithms (as dropout, stacked denoising auto-encoders, convolutional NNs), with other pattern recognition methods as HMMs among others. Additionally, in experimental stage, it is possible to perform automatic differentiation, for advanced ML research.
In order to allow capturing errors in Lua side (via pcall or xpcall), objects allocated in C++ should be smart enough to free all pending memory in the moment of the error. LuaPkg and APRIL-ANN have been changed to implement this procedure in some automatic way, LuaPkg wraps every C++ call using a try/catch block, and APRIL-ANN macros ERROR_EXIT throw an exception consisting in a simple char * message. This procedure allows to execute automatic C++ cleanup when the exception is thrown followed by the longjmp due to Lua errors.
Our problem is that not all C++ objects are error-safety, that is, some of them allocate memory in its methods and in case of error the memory stills allocated. A simple way to face this problem is to wrap all C++ allocations using AprilUtils::SharedPtr or AprilUtils::UniquePtr, so in case of error the allocated memory would freed automatically.
In order to allow capturing errors in Lua side (via pcall or xpcall), objects allocated in C++ should be smart enough to free all pending memory in the moment of the error. LuaPkg and APRIL-ANN have been changed to implement this procedure in some automatic way, LuaPkg wraps every C++ call using a try/catch block, and APRIL-ANN macros ERROR_EXIT throw an exception consisting in a simple char * message. This procedure allows to execute automatic C++ cleanup when the exception is thrown followed by the longjmp due to Lua errors. Our problem is that not all C++ objects are error-safety, that is, some of them allocate memory in its methods and in case of error the memory stills allocated. A simple way to face this problem is to wrap all C++ allocations using
AprilUtils::SharedPtr
orAprilUtils::UniquePtr
, so in case of error the allocated memory would freed automatically.