Class: GRX::Loss::MSELoss
- Inherits:
-
Object
- Object
- GRX::Loss::MSELoss
- Defined in:
- lib/grx/loss.rb
Overview
================================================================
MSELoss — Mean Squared Error L = mean((pred - target)^2) -> returns differentiable scalar Tensor
Instance Method Summary collapse
Instance Method Details
#call(pred, target) ⇒ Object
10 11 12 13 |
# File 'lib/grx/loss.rb', line 10 def call(pred, target) raise ShapeError, "Incompatible shapes: #{pred.shape} vs #{target.shape}" if pred.shape != target.shape (pred - target).square.mean end |