ClikaRT::ops::snake
function
snake()
Tensor snake(
Tensor x,
OptionalTensor alpha = {},
OptionalTensor beta = {},
double eps = 1e-9
)
Periodic "snake" activation (neural vocoders), per channels-last channel.
alpha (frequency) and beta (magnitude) are rank-1 [C] tensors over x's last dim, in the REAL domain. Apply exp once at setup for a log-scale checkpoint parameterization. beta absent selects the plain form (beta = alpha). One fused pass; the composed spelling costs five elementwise calls over the whole stream.
Parameters
x: the input tensor, channels-last[..., C].alpha: the[C]frequency tensor. Absent uses the alpha held by the bound primitive (module usage).beta: the[C]magnitude tensor. Absent selects the plain form.eps: the no-division-by-zero guard added tobeta.
Throws
ClikaRT::Error: when a param's length does not matchx's last dim, whenalphais absent with none bound, or when the dtype is not served (code_name()carries the reason).
Returns: a new tensor, same shape and dtype as x.
auto y = ClikaRT::ops::snake(x, freq, magnitude); // freq/magnitude: [C]
Declared in ClikaRT/compute/ops.h, line 1032