def METHOD_NAME(x):
    bdims = x.shape[:-2]
    M, D = x.shape[-2:]
    if M % 2 == 1:
        xend = x[..., -1, :].view(bdims + (1, D))  # used as dummy row to insert into x
        x = torch.cat((x, xend), dim=-2)
        tag_dummy = True
    else:
        tag_dummy = False
    return x, tag_dummy