ttnn.l1_loss

ttnn.l1_loss = Operation(python_fully_qualified_name='ttnn.l1_loss', function=<ttnn._ttnn.operations.loss.l1_loss_t object>, preprocess_golden_function_inputs=<function default_preprocess_golden_function_inputs>, golden_function=<function _golden_function_l1_loss>, postprocess_golden_function_outputs=<function default_postprocess_golden_function_outputs>, is_cpp_operation=True, is_experimental=False)

Returns mean absolute error loss function for input_reference and input_prediction

Parameters:
  • input_reference (ttnn.Tensor) – the input tensor.

  • input_prediction (ttnn.Tensor) – the input tensor.

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.l1_loss(input_reference, input_prediction, reduction)