Class: Torch::NN::MSELoss

Inherits:
Module
  • Object
show all
Defined in:
lib/torch/nn/mse_loss.rb

Instance Method Summary collapse

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