import torch


def laplace_cdf(s, beta, noise_std = 0):
  """CDF of the Laplace distribution with zero mean and beta scale."""
  beta_recip = 1. / beta
  x = s * beta_recip
  if noise_std:
    x = x + noise_std * torch.randn(x.shape, dtype=x.dtype, device=x.device)
  return torch.sigmoid(x)