<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_tri_2_sym(tri, dim):
 """convert a upper triangular matrix in 1D format to 2D symmetric matrix Parameters tri: 1D array Contains elements of upper triangular matrix dim : int The dimension of target matrix. Returns ------- symm : 2D array Symmetric matrix in shape=[dim, dim] """

    symm = np.zeros((dim, dim))
    symm[np.triu_indices(dim)] = tri
    return symm