Class: Transformers::DebertaV2::DebertaV2Intermediate
- Inherits:
-
Torch::NN::Module
- Object
- Torch::NN::Module
- Transformers::DebertaV2::DebertaV2Intermediate
- Defined in:
- lib/transformers/models/deberta_v2/modeling_deberta_v2.rb
Instance Method Summary collapse
- #forward(hidden_states) ⇒ Object
-
#initialize(config) ⇒ DebertaV2Intermediate
constructor
A new instance of DebertaV2Intermediate.
Constructor Details
#initialize(config) ⇒ DebertaV2Intermediate
Returns a new instance of DebertaV2Intermediate.
198 199 200 201 202 203 204 205 206 |
# File 'lib/transformers/models/deberta_v2/modeling_deberta_v2.rb', line 198 def initialize(config) super() @dense = Torch::NN::Linear.new(config.hidden_size, config.intermediate_size) if config.hidden_act.is_a?(String) @intermediate_act_fn = ACT2FN[config.hidden_act] else @intermediate_act_fn = config.hidden_act end end |
Instance Method Details
#forward(hidden_states) ⇒ Object
208 209 210 211 212 |
# File 'lib/transformers/models/deberta_v2/modeling_deberta_v2.rb', line 208 def forward(hidden_states) hidden_states = @dense.(hidden_states) hidden_states = @intermediate_act_fn.(hidden_states) hidden_states end |