Sine#

class Sine(*args, **kwargs)#

Bases: Module

Sine activation function used in SIREN networks.

Computes sin(x) element-wise. No frequency scaling is applied here; the omega_0 / hidden_omega_0 factors are absorbed into the weight initialisation (see _init_siren_weights) so that the effective frequency at each layer is determined at init without altering the forward pass arithmetic.

This design choice follows the SIREN paper and keeps the forward pass free of any scalar multiplications that might interact poorly with mixed-precision training.

Parameters:
(none beyond the base nn.Module bookkeeping)
forward(x)#

Apply sine element-wise.

Parameters:

x (Tensor) – Input tensor of any shape and dtype.

Returns:

Tensor of the same shape and dtype as x with values sin(x_i) for each element x_i.

Return type:

Tensor