you simply write it as such.
def forward(x, y1, y2):
    x1 = fc1(x)
    x2 = fc2(x1)
    l1 = center_loss(x1, y1)
    l2 = softmax_loss(x2, y2)
    return l1, l2

# later

torch.autograd.backward([l1, l2])