Dimension support, test torch bugfix, misc bugfixes