extensions to torch