Module nerv
NERV: a Lua-based toolkit for high-performance deep learning.
This file contains misc utility functions of NERV and finally initializes
NERV by including init.lua
of other basic modules.
Info:
- Author: Ted Yin
Functions
error_method_not_implemented () | Dummy function. |
sprintf (fmt, ...) | Format a string just like sprintf in C. |
printf (fmt, ...) | Print a formatted string to stdout. |
error (fmt, ...) | Raise an global error with the formatted message. |
info (fmt, ...) | Print a notification message that begins with "info" and a timestamp. |
warning (fmt, ...) | Print a warning message that begins with "warning" and a timestamp. |
class (tname, parenttname) | Create a class (Torch-compatible). |
table.tostring (tbl) | Get the string representation of a table, which can be executed as a valid piece of Lua code. |
get_type (tname) | Get the class by name. |
is_type (obj, tname) | Check if the object is of the certain class. |
dirname (filename) | Strip last component from file name. |
include (filename) | Include a script file (chunk) into the current script. |
Functions
- error_method_not_implemented ()
- Dummy function. Display a friendly error message when user attempts to invoke a non-implemented function.
- sprintf (fmt, ...)
-
Format a string just like sprintf in C.
Parameters:
- fmt the format string
- ... args, the data to be formatted
Returns:
-
the formatted string
- printf (fmt, ...)
-
Print a formatted string to stdout.
Parameters:
- fmt the format string
- ... args, the data to be formatted
- error (fmt, ...)
-
Raise an global error with the formatted message.
Parameters:
- fmt the format string
- ... args, the data to be formatted
- info (fmt, ...)
-
Print a notification message that begins with "info" and a timestamp.
Instead of using nerv.printf, normal users should use this to print any
notification information.
Parameters:
- fmt the format string
- ... args, the data to be formatted
- warning (fmt, ...)
-
Print a warning message that begins with "warning" and a timestamp.
Instead of using nerv.printf, normal users should use this to print any
warnings.
Parameters:
- fmt the format string
- ... args, the data to be formatted
- class (tname, parenttname)
-
Create a class (Torch-compatible).
Use this to create a class in NERV.
Parameters:
- tname the class name
- parenttname the parent class name (from which it inherits)
Returns:
-
the created class
- table.tostring (tbl)
-
Get the string representation of a table, which can be executed as a valid
piece of Lua code.
Parameters:
- tbl the table
Returns:
-
the string representation which will result in a Lua table entity
when evaluated
- get_type (tname)
-
Get the class by name.
Parameters:
- tname the name of the class
Returns:
-
the class entity
- is_type (obj, tname)
-
Check if the object is of the certain class.
Parameters:
- obj the object ("class instance")
- tname the class name ("type name")
- dirname (filename)
-
Strip last component from file name.
Parameters:
- filename the path to a file
Returns:
-
the path to the containing directory
- include (filename)
-
Include a script file (chunk) into the current script.
An analogy to
#include
in C. Note that the effect is the same as executingdofile(filename)
at the current line.Parameters:
- filename the path to a file
Returns:
-
all values returned by the chunk