//! GPU loss functions for training neural networks.
//!
//! All loss functions operate on [`GpuVariable`]s and produce scalar outputs
//! suitable for calling [`backward()`](super::variable::GpuVariable::backward).
use ops;
use GpuVariable;
use crateResult;
/// GPU Mean Squared Error loss: `mean((pred - target)^2)`.
///
/// Both `pred` and `target` must have the same shape.
/// Returns a scalar (shape `[1]`) variable.
/// GPU Cross-entropy loss (simplified).
///
/// `pred` should be log-probabilities (e.g. output of log-softmax) and `target`
/// should be one-hot encoded labels. Computes: `-mean(target * pred)`.
///
/// Returns a scalar (shape `[1]`) variable.