//! Common types and utilities for loss functions
//!//! This module provides shared types and helper functions used across
//! different loss function categories.
usetorsh_core::Result as TorshResult;usetorsh_tensor::Tensor;/// Reduction type for loss functions
#[derive(Debug, Clone, Copy, PartialEq, Eq)]pubenumReductionType{/// No reduction applied
None,/// Mean reduction
Mean,/// Sum reduction
Sum,}implReductionType{/// Apply the reduction to a tensor
pubfnapply(&self, tensor: Tensor)->TorshResult<Tensor>{matchself{Self::None =>Ok(tensor),Self::Mean => tensor.mean(None,false),Self::Sum => tensor.sum(),}}}