Skip to content

Commit

Permalink
Update losses.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Chirag Nagpal authored Jul 10, 2022
1 parent 01bb05c commit f86d654
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions auton_survival/models/dsm/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def _weibull_pdf(model, x, t_horizon, risk='1'):
lpdfs = torch.stack(lpdfs, dim=1)
lpdfs = lpdfs+logits
lpdfs = torch.logsumexp(lpdfs, dim=1)
pdfs.append(lpdfs.detach().numpy())
pdfs.append(lpdfs.detach().cpu().numpy())

return pdfs

Expand Down Expand Up @@ -357,7 +357,7 @@ def _weibull_cdf(model, x, t_horizon, risk='1'):
lcdfs = torch.stack(lcdfs, dim=1)
lcdfs = lcdfs+logits
lcdfs = torch.logsumexp(lcdfs, dim=1)
cdfs.append(lcdfs.detach().numpy())
cdfs.append(lcdfs.detach().cpu().numpy())

return cdfs

Expand Down Expand Up @@ -424,7 +424,7 @@ def _lognormal_cdf(model, x, t_horizon, risk='1'):
lcdfs = torch.stack(lcdfs, dim=1)
lcdfs = lcdfs+logits
lcdfs = torch.logsumexp(lcdfs, dim=1)
cdfs.append(lcdfs.detach().numpy())
cdfs.append(lcdfs.detach().cpu().numpy())

return cdfs

Expand Down Expand Up @@ -461,7 +461,7 @@ def _normal_cdf(model, x, t_horizon, risk='1'):
lcdfs = torch.stack(lcdfs, dim=1)
lcdfs = lcdfs+logits
lcdfs = torch.logsumexp(lcdfs, dim=1)
cdfs.append(lcdfs.detach().numpy())
cdfs.append(lcdfs.detach().cpu().numpy())

return cdfs

Expand All @@ -485,7 +485,7 @@ def _normal_mean(model, x, risk='1'):
lmeans = lmeans*logits
lmeans = torch.sum(lmeans, dim=1)

return lmeans.detach().numpy()
return lmeans.detach().cpu().numpy()


def predict_mean(model, x, risk='1'):
Expand Down

0 comments on commit f86d654

Please sign in to comment.