Wraps a user-supplied function into a validated custom activation,
ensuring it accepts and returns a torch_tensor. Performs an eager
dry-run probe at definition time so errors surface early, and
wraps the function with a call-time type guard for safety.
new_act_fn(fn, probe = TRUE, .name = "") An object of class c("custom_activation", "parameterized_activation"),
compatible with act_funs().
A function taking a single tensor argument and returning a tensor.
E.g. \(x) torch::torch_tanh(x).
Logical. If TRUE (default), runs a dry-run with a small
dummy tensor at definition time to catch obvious errors early.
A string to be stored in an attribute. Nothing special, except it is
used when displaying the info of a trained neural network model.
Default is "<custom>".