Fixed type/size checking for array of arrays.

Added more robust type checking for array of arrays. Also fixes array dimension comparison which prevented training_data.set_train_data from working.