tensor cleanup