Class: Transformers::DebertaV2::DebertaV2SelfOutput
- Inherits:
-
Torch::NN::Module
- Object
- Torch::NN::Module
- Transformers::DebertaV2::DebertaV2SelfOutput
- Defined in:
- lib/transformers/models/deberta_v2/modeling_deberta_v2.rb
Instance Method Summary collapse
- #forward(hidden_states, input_tensor) ⇒ Object
-
#initialize(config) ⇒ DebertaV2SelfOutput
constructor
A new instance of DebertaV2SelfOutput.
Constructor Details
#initialize(config) ⇒ DebertaV2SelfOutput
Returns a new instance of DebertaV2SelfOutput.
149 150 151 152 153 154 |
# File 'lib/transformers/models/deberta_v2/modeling_deberta_v2.rb', line 149 def initialize(config) super() @dense = Torch::NN::Linear.new(config.hidden_size, config.hidden_size) @LayerNorm = Torch::NN::LayerNorm.new(config.hidden_size, eps: config.layer_norm_eps) @dropout = StableDropout.new(config.hidden_dropout_prob) end |
Instance Method Details
#forward(hidden_states, input_tensor) ⇒ Object
156 157 158 159 160 161 |
# File 'lib/transformers/models/deberta_v2/modeling_deberta_v2.rb', line 156 def forward(hidden_states, input_tensor) hidden_states = @dense.(hidden_states) hidden_states = @dropout.(hidden_states) hidden_states = @LayerNorm.(hidden_states + input_tensor) hidden_states end |