Class: Torch::NN::MSELoss
Instance Method Summary collapse
- #forward(input, target) ⇒ Object
-
#initialize(reduction: "mean") ⇒ MSELoss
constructor
A new instance of MSELoss.
Methods inherited from Module
#call, #inspect, #method_missing, #parameters, #respond_to?, #zero_grad
Constructor Details
#initialize(reduction: "mean") ⇒ MSELoss
Returns a new instance of MSELoss.
4 5 6 |
# File 'lib/torch/nn/mse_loss.rb', line 4 def initialize(reduction: "mean") @reduction = reduction end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Torch::NN::Module
Instance Method Details
#forward(input, target) ⇒ Object
8 9 10 |
# File 'lib/torch/nn/mse_loss.rb', line 8 def forward(input, target) F.mse_loss(input, target, reduction: @reduction) end |