Skip to contents

First applies the linear transformation to all inputs, then replaces outputs for inputs where all values equal skip_value with the skip_value.

Usage

skippable_linear(in_features, out_features, bias = TRUE, skip_value = -100)

Arguments

in_features

Integer. Size of each input sample.

out_features

Integer. Size of each output sample.

bias

Logical. If FALSE, the layer will not learn an additive bias (default: TRUE).

skip_value

Numeric. Value used to mark inputs that should be skipped (default: -100.0).

Value

A nn_module that applies linear transformation with skip handling.

Examples

if (FALSE) { # \dontrun{
layer <- skippable_linear(in_features = 10L, out_features = 20L)
x <- torch_randn(32L, 10L)
x[1:5, ] <- -100.0  # Mark rows to skip
out <- layer(x)  # Skipped rows remain -100.0 in output
} # }