SoftplusScale#

class sdm.nn.SoftplusScale(channels: int, multiplier: float = 1.0, weight_init: float = 0.0, device: device | str | None = None, dtype: dtype | None = None)#

Bases: Module

Apply a learned positive scale to the final input dimension.

Each channel is multiplied by a positive factor parametrized as multiplier * softplus(weight).

Parameters:
  • channels (int) – The number of input and output channels.

  • multiplier (float) – The fixed multiplier applied to every learned factor.

  • weight_init (float) – The initial values of weight.

  • device (device | str | None) – The device.

  • dtype (dtype | None) – The parameter dtype.

forward(tensor: Tensor) → Tensor#

The forward pass.

Parameters:

tensor (Tensor) – The input tensor.

Return type:

Tensor