Class: Transformers::Vit::ViTSelfOutput
- Inherits:
-
Torch::NN::Module
- Object
- Torch::NN::Module
- Transformers::Vit::ViTSelfOutput
- Defined in:
- lib/transformers/models/vit/modeling_vit.rb
Instance Method Summary collapse
- #forward(hidden_states, input_tensor) ⇒ Object
-
#initialize(config) ⇒ ViTSelfOutput
constructor
A new instance of ViTSelfOutput.
Constructor Details
#initialize(config) ⇒ ViTSelfOutput
Returns a new instance of ViTSelfOutput.
166 167 168 169 170 |
# File 'lib/transformers/models/vit/modeling_vit.rb', line 166 def initialize(config) super() @dense = Torch::NN::Linear.new(config.hidden_size, config.hidden_size) @dropout = Torch::NN::Dropout.new(p: config.hidden_dropout_prob) end |
Instance Method Details
#forward(hidden_states, input_tensor) ⇒ Object
172 173 174 175 176 177 |
# File 'lib/transformers/models/vit/modeling_vit.rb', line 172 def forward(hidden_states, input_tensor) hidden_states = @dense.(hidden_states) hidden_states = @dropout.(hidden_states) hidden_states end |