ttnn.mse_loss

ttnn.mse_loss(input_reference: ttnn.Tensor, input_prediction: ttnn.Tensor, *, reduction: bool | None = None, output_tensor: ttnn.Tensor | None = None, memory_config: ttnn.MemoryConfig | None = None, queue_id: int | None = 0) ttnn.Tensor

Returns mean squared error loss function for input_reference and input_prediction

Parameters:
Keyword Arguments:
  • reduction (bool, optional) – Loss Reduction Mode. Defaults to None.

  • output_tensor (ttnn.Tensor, optional) – Preallocated output tensor. Defaults to None.

  • memory_config (ttnn.MemoryConfig, optional) – Memory configuration for the operation. Defaults to None.

  • queue_id (int, optional) – command queue id. Defaults to 0.

Returns:

ttnn.Tensor – the output tensor.

Example

>>> input_reference = ttnn.to_device(ttnn.from_torch(torch.tensor((1, 2), dtype=torch.bfloat16)), device=device)
>>> input_prediction = ttnn.to_device(ttnn.from_torch(torch.tensor((1, 2), dtype=torch.bfloat16)), device=device)
>>> output = ttnn.mse_loss(input_reference, input_prediction, reduction)