'Backward propagate lookup table layer.
Arguments:
nin (int): Number of input word_ids.
inputs (Tensor): Input tensor.
error (Tensor): Error tensor.
error_t (Tensor): Transposed error tensor.
dW (Tensor): Gradient tensor (delta).
pad_idx (int):
alpha (float):
beta (float):'

def compound_bprop_lut(self, nin, inputs, error, error_t, dW, pad_idx, alpha=1.0, beta=0):

    wrd_ids = inputs._tensor[0]
    (unqidx, inv) = np.unique(wrd_ids, return_inverse=True)
    groups = [np.where((inv == i)) for i in range(len(unqidx))]
    for (wrd_id, group) in zip(unqidx, groups):
        if (wrd_id != pad_idx):
            dW[wrd_id, :] = self.sum(error.take(group[0], axis=1), axis=1)
    '\n                                alternative    bprop\n                                for    (j,    wrd_id)    in    enumerate(wrd_ids):\n                                                dW[:,    wrd_id]    =    dW[:,    wrd_id]    +    error[:,    j]\n                                '
