Writes object into the file. This object can be read later using readObject(). Serializable objects are Torch objects having a read() and write() method. Lua objects such as table, number or string are also serializable.

If the object has been already written in the file, only a reference to this already saved object will be written: this saves space an speed-up writing; it also allows to keep the dependencies between objects intact.

In returns, if one writes an object, modify its member, and write the object again in the same file, the modifications will not be recorded in the file, as only a reference to the original will be written. See readObject() for an example.