def gather_3rd(params, indices):
    """Special case of tf.gather_nd where indices.shape[-1] == 3
    
    Check https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/gather_nd
        for details.

    Args:
        params: Tensor, shaped [B, d_1, ..., d_i], di >= 2
        indices: LongTensor, shaped [B, i_1, ...,i_{k-1}, 3]
    Returns:
        Tensor, of shape indices.shape[:-1] + params.shape[indices.shape[-1]:]
    """
    return params[indices[..., 0], indices[..., 1], indices[..., 2]]