ClikaRT::nn::PReLU
class
Header: ClikaRT/nn/prelu.h
Inherits: ClikaRT::nn::Module
Parametric ReLU.
weight is one value shared by every element (num_parameters = 1) or one value per channel (num_parameters = the channel count, broadcast against the input). The module form of ops::prelu.
auto act = ClikaRT::nn::PReLU::make(); // one slope, 0.25
auto y = (*act)(x);
Static member functions
make()
static std::shared_ptr<PReLU> make(std::int64_t num_parameters = 1, PReLUOptions options = {})
Construct with a real weight [num_parameters] filled with options.init on options.dtype / options.device; the module is usable without a checkpoint, and a bind replaces the weight. Raises ClikaRT::Error on a parameter count that is not positive.
Declared in ClikaRT/nn/prelu.h, line 69
Member functions
set_weights()
void set_weights(Tensor weight)
Bind weight ([num_parameters]) positionally. The declared placement wins; the shape must match the declaration; the next forward rebuilds. Raises ClikaRT::Error on a geometry mismatch.
Declared in ClikaRT/nn/prelu.h, line 78
~PReLU()
~PReLU() override
Declared in ClikaRT/nn/prelu.h, line 82
to_impl(StreamOrDevice)
virtual Result<void> to_impl(StreamOrDevice where) override
Move to a placement (Device / Stream) or cast to a dtype. Rebuilds over the moved weight on the next forward.
Declared in ClikaRT/nn/prelu.h, line 86
to_impl(DataType)
Declared in ClikaRT/nn/prelu.h, line 87
forward()
Applies the activation to input with the held slopes; output shape and dtype follow input. The first call builds (once, thread-safe). Raises ClikaRT::Error when the weight does not broadcast against input.
Declared in ClikaRT/nn/prelu.h, line 94
operator()()
Same as forward.
Declared in ClikaRT/nn/prelu.h, line 98
num_parameters()
std::int64_t num_parameters() const noexcept
The slope count the module was made with.
Declared in ClikaRT/nn/prelu.h, line 103
options()
const PReLUOptions& options() const noexcept
The settings the module was made with.
Declared in ClikaRT/nn/prelu.h, line 105
Protected member functions
initialize_impl()
virtual Result<void> initialize_impl() override
The pack hook: builds the activation over the bound weight (idempotent, thread-safe).
Declared in ClikaRT/nn/prelu.h, line 115