Class: Transformers::XlmRoberta::XLMRobertaIntermediate
- Inherits:
-
Torch::NN::Module
- Object
- Torch::NN::Module
- Transformers::XlmRoberta::XLMRobertaIntermediate
- Defined in:
- lib/transformers/models/xlm_roberta/modeling_xlm_roberta.rb
Instance Method Summary collapse
- #forward(hidden_states) ⇒ Object
-
#initialize(config) ⇒ XLMRobertaIntermediate
constructor
A new instance of XLMRobertaIntermediate.
Constructor Details
#initialize(config) ⇒ XLMRobertaIntermediate
Returns a new instance of XLMRobertaIntermediate.
385 386 387 388 389 390 391 392 393 |
# File 'lib/transformers/models/xlm_roberta/modeling_xlm_roberta.rb', line 385 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
395 396 397 398 399 |
# File 'lib/transformers/models/xlm_roberta/modeling_xlm_roberta.rb', line 395 def forward(hidden_states) hidden_states = @dense.(hidden_states) hidden_states = @intermediate_act_fn.(hidden_states) hidden_states end |