Fixed a bug in tensor_multiply if result is a vector.