if not tl.shape(tensor) == (size, )*order:
raise ValueError("The input tensor does not have the same size along each mode.")
factor = tl.zeros((size, rank), **tl.context(tensor))
weigths = tl.zeros(rank, **tl.context(tensor))
for i in range(rank):
eigenval, eigenvec, deflated = symmetric_power_iteration(tensor, n_repeat=n_repeat, n_iteration=n_iteration, verbose=verbose)
factor = tl.index_update(factor, tl.index[:, i], eigenvec)
weigths = tl.index_update(weigths, tl.index[i], eigenval)
tensor = deflated
return weigths, factor