Move tensor variable stuff in a new file.