Converts a tensor to an array.