<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_overlaps_tensor(self, L):
 """Transforms the input label matrix to a three-way overlaps tensor. Args: independent LFs on n data points Outputs: O: (torch.Tensor) A (m, m, m, k, k, k) tensor of the label-specific empirical overlap rates; that is, O[i,j,k,y1,y2,y3] = P(\lf_i = y1, \lf_j = y2, \lf_k = y3) where this quantity is computed empirically by this function, based on the label matrix L. """

        n, m = L.shape

        # Convert from a (n,m) matrix of ints to a (k_lf, n, m) indicator tensor
        LY = np.array([np.where(L == y, 1, 0) for y in range(self.k_0, self.k + 1)])

        # Form the three-way overlaps matrix
        O = np.einsum("abc,dbe,fbg->cegadf", LY, LY, LY) / n
        return torch.from_numpy(O).float()