Legendre Decomposition for Tensors