Loading...
Searching...
No Matches
opennn::Dense Class Referencefinal
#include <opennn/network/layers/dense_layer.h>
Inheritance diagram for opennn::Dense:
Public Member Functions | |
| Dense (const Shape &={}, const Shape &={}, const string &="Tanh", BatchNormalization=BatchNormalization::No, const string &="dense_layer") | |
| Shape | get_output_shape () const override |
| Index | get_input_features () const |
| const ActivationFunction & | get_activation_function () const |
| ActivationFunction | get_output_activation () const override |
| bool | get_batch_normalization () const |
| vector< TensorSpec > | get_forward_specs (Index) const override |
| vector< TensorSpec > | get_backward_specs (Index) const override |
| bool | backward_uses_forward_output () const noexcept override |
| bool | preserves_output_delta_during_backward () const noexcept override |
| bool | folds_input_delta_addend (size_t input) const noexcept override |
| ForwardSlotKind | get_forward_slot_kind (size_t slot) const override |
| void | set (const Shape &={}, const Shape &={}, const string &="Tanh", BatchNormalization=BatchNormalization::No, const string &="dense_layer") |
| bool | accepts_input_rank (Index rank) const override |
| void | apply_input_shape (const Shape &) override |
| void | set_output_shape (const Shape &) override |
| void | on_compute_dtype_changed () override |
| void | set_activation_function (const string &) |
| void | set_batch_normalization (bool enable) |
| void | set_use_bias (bool use_bias) |
| bool | get_use_bias () const |
| void | set_gated (bool new_gated) |
| bool | get_gated () const |
| void | set_transposed_inference (bool v) |
| bool | get_transposed_inference () const |
| void | set_tied_weight_source (const Layer *) |
| void | set_tied_weight (const TiedWeight &) override |
| TiedWeight | get_tied_weight () const override |
| void | set_dropout_rate (float new_rate) |
| void | set_momentum (float) |
| bool | try_wire_drelu_fusion (Dense &producer, Index producer_layer) |
| bool | try_wire_single_output_relu_fusion (Dense &producer, Index producer_layer) |
| void | reset_single_output_relu_fusion () |
| bool | single_output_relu_fusion_wired () const |
| void | reset_drelu_fusion () |
| bool | drelu_fusion_wired () const |
| void | read_JSON_body (const Json *) override |
| void | write_JSON_body (JsonWriter &) const override |
| void | on_loaded () override |
| string | write_expression (const vector< string > &, const vector< string > &) const override |
Public Member Functions inherited from opennn::Layer | |
| virtual | ~Layer ()=default |
| const string & | get_label () const noexcept |
| const string & | get_name () const |
| LayerType | get_type () const noexcept |
| void | set_input_shape (const Shape &new_input_shape) |
| void | set_label (string new_label) |
| Index | get_parameters_number () const |
| const vector< Operator * > & | get_operators () const noexcept |
| virtual vector< TensorSpec > | get_parameter_specs () const |
| virtual vector< TensorSpec > | get_state_specs () const |
| virtual bool | is_forward_slot_inference_elidable (size_t, Device) const noexcept |
| virtual size_t | get_recomputable_forward_slot () const noexcept |
| virtual void | recompute_forward_slot (ForwardPropagation &, size_t) |
| virtual bool | backward_uses_input (size_t) const noexcept |
| virtual bool | allows_input_delta_alias () const noexcept |
| virtual Shape | get_input_shape () const noexcept |
| virtual Index | get_sources_number () const noexcept |
| virtual bool | allows_successors () const noexcept |
| virtual bool | is_recurrent () const noexcept |
| virtual bool | skip_for_pre_scaled_input () const noexcept |
| virtual bool | uses_sequence_position () const noexcept |
| virtual bool | allows_bf16_input_cast (size_t) const noexcept |
| Index | get_inputs_number () const noexcept |
| Index | get_outputs_number () const |
| virtual void | forward_propagate (ForwardPropagation &forward_propagation, size_t layer, ForwardPropagationMode pass) |
| virtual void | back_propagate (ForwardPropagation &forward_propagation, BackPropagation &back_propagation, size_t i) const |
| virtual void | from_JSON (const JsonDocument &) |
| virtual void | load_state_from_JSON (const JsonDocument &) |
| virtual void | to_JSON (JsonWriter &) const |
| bool | get_is_trainable () const noexcept |
| void | set_is_trainable (bool trainable) |
| Type | get_compute_dtype () const noexcept |
| Device | get_compute_device () const noexcept |
| void | set_compute_dtype (Type new_compute_dtype) |
| void | set_compute_device (Device new_compute_device) |
| virtual float * | link_states (float *, Device) |
| float * | link_gradients (float *, Device) |
| vector< TensorView > & | get_parameter_views () |
| const vector< TensorView > & | get_parameter_views () const noexcept |
| vector< TensorView > & | get_parameter_scales () |
| const vector< TensorView > & | get_parameter_scales () const noexcept |
| vector< Operator::SlotQuantization > | get_parameter_quantization () const |
| void | redistribute_parameters_to_operators () |
Public Attributes | |
| Dense * | drelu_producer = nullptr |
Additional Inherited Members | |
Protected Types inherited from opennn::Layer | |
| enum | Forward { Input , Output } |
Protected Member Functions inherited from opennn::Layer | |
| Layer (LayerType type, Trainability trainability=Trainability::Trainable) | |
| float * | link_views_to_operators (vector< TensorView > &, float *, vector< TensorSpec >(Operator::*specs_fn)() const, void(Operator::*link_fn)(span< const TensorView >), Device) |
Static Protected Member Functions inherited from opennn::Layer | |
| static bool | refresh_feature_storage (Buffer &storage, bool &dirty, Device device, Index features, Index columns, const function< void(float *)> &fill) |
Protected Attributes inherited from opennn::Layer | |
| string | label = "my_layer" |
| bool | is_trainable = true |
| Shape | input_shape |
| Type | compute_dtype = Type::FP32 |
| Type | weights_dtype = Type::FP32 |
| Device | compute_device = Device::CPU |
| vector< TensorView > | parameters |
| vector< TensorView > | parameter_scales |
| vector< TensorView > | states |
| vector< Operator * > | operators |
Constructor & Destructor Documentation
◆ Dense()
| opennn::Dense::Dense | ( | const Shape & | = {}, |
| const Shape & | = {}, | ||
| const string & | = "Tanh", | ||
| BatchNormalization | = BatchNormalization::No, | ||
| const string & | = "dense_layer" ) |
Member Function Documentation
◆ accepts_input_rank()
|
inlineoverridevirtual |
Reimplemented from opennn::Layer.
◆ apply_input_shape()
|
overridevirtual |
Reimplemented from opennn::Layer.
◆ backward_uses_forward_output()
|
inlineoverridevirtualnoexcept |
Reimplemented from opennn::Layer.
◆ drelu_fusion_wired()
|
inline |
◆ folds_input_delta_addend()
|
inlineoverridevirtualnoexcept |
Reimplemented from opennn::Layer.
◆ get_activation_function()
|
inline |
◆ get_backward_specs()
|
overridevirtual |
Reimplemented from opennn::Layer.
◆ get_batch_normalization()
|
inline |
◆ get_forward_slot_kind()
|
inlineoverridevirtual |
Reimplemented from opennn::Layer.
◆ get_forward_specs()
|
overridevirtual |
Reimplemented from opennn::Layer.
◆ get_gated()
|
inline |
◆ get_input_features()
|
inline |
◆ get_output_activation()
|
inlineoverridevirtual |
Reimplemented from opennn::Layer.
◆ get_output_shape()
|
overridevirtual |
Implements opennn::Layer.
◆ get_tied_weight()
|
inlineoverridevirtual |
Reimplemented from opennn::Layer.
◆ get_transposed_inference()
|
inline |
◆ get_use_bias()
|
inline |
◆ on_compute_dtype_changed()
|
inlineoverridevirtual |
Reimplemented from opennn::Layer.
◆ on_loaded()
|
inlineoverridevirtual |
Reimplemented from opennn::Layer.
◆ preserves_output_delta_during_backward()
|
inlineoverridevirtualnoexcept |
Reimplemented from opennn::Layer.
◆ read_JSON_body()
|
overridevirtual |
Reimplemented from opennn::Layer.
◆ reset_drelu_fusion()
| void opennn::Dense::reset_drelu_fusion | ( | ) |
◆ reset_single_output_relu_fusion()
| void opennn::Dense::reset_single_output_relu_fusion | ( | ) |
◆ set()
| void opennn::Dense::set | ( | const Shape & | = {}, |
| const Shape & | = {}, | ||
| const string & | = "Tanh", | ||
| BatchNormalization | = BatchNormalization::No, | ||
| const string & | = "dense_layer" ) |
◆ set_activation_function()
| void opennn::Dense::set_activation_function | ( | const string & | ) |
◆ set_batch_normalization()
| void opennn::Dense::set_batch_normalization | ( | bool | enable | ) |
◆ set_dropout_rate()
|
inline |
◆ set_gated()
| void opennn::Dense::set_gated | ( | bool | new_gated | ) |
◆ set_momentum()
| void opennn::Dense::set_momentum | ( | float | ) |
◆ set_output_shape()
|
overridevirtual |
Reimplemented from opennn::Layer.
◆ set_tied_weight()
|
overridevirtual |
Reimplemented from opennn::Layer.
◆ set_tied_weight_source()
| void opennn::Dense::set_tied_weight_source | ( | const Layer * | ) |
◆ set_transposed_inference()
|
inline |
◆ set_use_bias()
|
inline |
◆ single_output_relu_fusion_wired()
|
inline |
◆ try_wire_drelu_fusion()
| bool opennn::Dense::try_wire_drelu_fusion | ( | Dense & | producer, |
| Index | producer_layer ) |
◆ try_wire_single_output_relu_fusion()
| bool opennn::Dense::try_wire_single_output_relu_fusion | ( | Dense & | producer, |
| Index | producer_layer ) |
◆ write_expression()
|
overridevirtual |
Reimplemented from opennn::Layer.
◆ write_JSON_body()
|
overridevirtual |
Reimplemented from opennn::Layer.
Member Data Documentation
◆ drelu_producer
| Dense* opennn::Dense::drelu_producer = nullptr |
Public Member Functions inherited from