def update_K(alpha, beta):
    'log space computation'
    'memory efficient'
    torch.add(alpha.reshape((- 1), 1), beta.reshape(1, (- 1)), out=K)
    torch.add(K, (- C), out=K)
    torch.div(K, reg, out=K)
    torch.exp(K, out=K)
log space computation
def update_K(alpha, beta):
    
    'memory efficient'
    torch.add(alpha.reshape((- 1), 1), beta.reshape(1, (- 1)), out=K)
    torch.add(K, (- C), out=K)
    torch.div(K, reg, out=K)
    torch.exp(K, out=K)