R/torch_soft_threshold.R

Defines functions torch_soft_threshold

#' @export
torch_soft_threshold<-function(x,tau)
{
  x_sign = torch_sign(x)
  x_abs = torch_abs(x)
  y = x_sign*torch_relu(x_abs - tau)
  return(y)
}
adsb85/lqp documentation built on April 9, 2022, 12:35 a.m.