def METHOD_NAME(self, ref, pred):
    if not isinstance(ref, torch.IntTensor):
        raise TypeError("ref must be a torch.IntTensor (got {})".format(type(ref)))
    if not isinstance(pred, torch.IntTensor):
        raise TypeError("pred must be a torch.IntTensor(got {})".format(type(pred)))
    # don't match unknown words
    rref = ref.clone()
    assert not rref.lt(0).any()
    rref[rref.eq(self.unk)] = -999
    rref = rref.contiguous().view(-1)
    pred = pred.contiguous().view(-1)
    self.C.bleu_add(
        ctypes.byref(self.stat),
        ctypes.c_size_t(rref.size(0)),
        ctypes.c_void_p(rref.data_ptr()),
        ctypes.c_size_t(pred.size(0)),
        ctypes.c_void_p(pred.data_ptr()),
        ctypes.c_int(self.pad),
        ctypes.c_int(self.eos),
    )