OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
opennn::BoundOp Struct Reference

Clamps each output channel to a configurable lower/upper interval. More...

#include <operators.h>

Inheritance diagram for opennn::BoundOp:
[legend]

Public Types

enum class  Method { NoBounding , Bounding }
 Disables bounding or enables per-channel clamping. More...
 

Public Member Functions

void forward_propagate (ForwardPropagation &fp, size_t layer, bool is_training) noexcept override
 Runs the operator's forward computation.
 
- Public Member Functions inherited from opennn::Operator
virtual ~Operator ()=default
 
virtual vector< TensorSpecparameter_specs () const
 Returns the tensor specs of trainable parameters owned by this operator.
 
virtual vector< TensorSpecstate_specs () const
 Returns the tensor specs of persistent state owned by this operator.
 
virtual void link_parameters (span< const TensorView >)
 Binds parameter views provided by the hosting layer.
 
virtual void link_gradients (span< const TensorView >)
 Binds gradient views provided by the hosting layer.
 
virtual void link_states (span< const TensorView >)
 Binds state views provided by the hosting layer.
 
virtual void set_parameters_random ()
 Initializes parameters with random values.
 
virtual void set_parameters_glorot ()
 Initializes parameters using Glorot (Xavier) initialization.
 
virtual void back_propagate (ForwardPropagation &, BackPropagation &, size_t) const noexcept
 Runs the operator's backward computation, accumulating into gradient/delta buffers.
 
virtual void to_JSON (JsonWriter &) const
 Serializes the operator configuration to a JSON writer.
 
virtual void from_JSON (const Json *)
 Restores the operator configuration from a JSON node.
 
virtual void load_state_from_JSON (const Json *)
 Restores persistent state (e.g. running statistics) from a JSON node.
 
virtual void destroy_cuda ()
 Releases CUDA resources owned by the operator; called from destructors.
 
TensorViewget_input (ForwardPropagation &fp, size_t layer, size_t i=0) const noexcept
 
vector< TensorView > & get_inputs (ForwardPropagation &fp, size_t layer, size_t i=0) const noexcept
 
TensorViewget_output (ForwardPropagation &fp, size_t layer, size_t i=0) const noexcept
 
TensorViewget_output_delta (BackPropagation &bp, size_t layer, size_t i=0) const noexcept
 
TensorViewget_input_delta (BackPropagation &bp, size_t layer, size_t i=0) const noexcept
 

Public Attributes

Method method = Method::Bounding
 
TensorView lower
 
TensorView upper
 
- Public Attributes inherited from opennn::Operator
vector< size_t > input_slots = {0}
 
vector< size_t > output_slots = {1}
 
vector< size_t > input_delta_slots = {1}
 
vector< size_t > output_delta_slots = {0}
 

Detailed Description

Clamps each output channel to a configurable lower/upper interval.

Member Enumeration Documentation

◆ Method

enum class opennn::BoundOp::Method
strong

Disables bounding or enables per-channel clamping.

Enumerator
NoBounding 
Bounding 

Member Function Documentation

◆ forward_propagate()

void opennn::BoundOp::forward_propagate ( ForwardPropagation & fp,
size_t layer,
bool is_training )
overridevirtualnoexcept

Runs the operator's forward computation.

Parameters
fpForward propagation workspace.
layerIndex of the hosting layer in the workspace.
is_trainingIf true, enables training-only behavior (e.g. dropout sampling).

Reimplemented from opennn::Operator.

Member Data Documentation

◆ lower

TensorView opennn::BoundOp::lower

◆ method

Method opennn::BoundOp::method = Method::Bounding

◆ upper

TensorView opennn::BoundOp::upper