Loss Functions
- 
                  
                  Computes the (element-wise) binary cross entropy loss on the given and expected probabilities and uses the mean as a reduction. expected and predicted are assumed to be in the interval (0, 1). The binary cross entropy loss is defined as -expected * log(predicted) - (1 - expected) * log(1 - predicted)DeclarationSwift public func binaryCrossEntropy<Element, Device>(expected: Tensor<Element, Device>, actual: Tensor<Element, Device>) -> Tensor<Element, Device> where Element : NumericType, Device : DeviceTypeParametersexpectedExpected values actualPredicted values ignoreIndexValue in expected, which is ignored. Return ValueLoss, scalar value 
- 
                  
                  Computes the categorical cross entropy loss on the given expected probabilities and the expected labels and uses the mean as a reduction. predicted values are assumed to be in the interval (0, 1) The categorical cross entropy loss is defined as -log(predicted[expected])DeclarationSwift public func categoricalCrossEntropy<Element, Device>(expected: Tensor<Int32, Device>, actual: Tensor<Element, Device>, ignoreIndex: Int32 = -1) -> Tensor<Element, Device> where Element : NumericType, Device : DeviceTypeParametersexpectedExpected labels actualPredicted values ignoreIndexValue in expected, which is ignored. Return ValueLoss, scalar value 
- 
                  
                  Computes the categorical negative log likelihood (NLL) loss on the given expected probabilities and the expected labels and uses the mean as a reduction. Predicted values are assumed to be in the interval (-infinity, 0). NLL loss should be used in conjunction with logSoftmax. The categorical NLL loss is defined as -predicted[expected]DeclarationSwift public func categoricalNegativeLogLikelihood<Element, Device>(expected: Tensor<Int32, Device>, actual: Tensor<Element, Device>, ignoreIndex: Int32 = -1) -> Tensor<Element, Device> where Element : NumericType, Device : DeviceTypeParametersexpectedExpected labels actualPredicted values Return ValueLoss, scalar value 
- 
                  
                  Computes the element-wise mean squared error between the given predicted and expected values DeclarationSwift public func meanSquaredError<Element, Device>(expected: Tensor<Element, Device>, actual: Tensor<Element, Device>) -> Tensor<Element, Device> where Element : NumericType, Device : DeviceTypeParametersexpectedExpected values actualPredicted values 
- 
                  
                  Computes the L1 loss of the given tensor. DeclarationSwift public func l1loss<Element, Device>(_ vector: Tensor<Element, Device>, loss: Element) -> Tensor<Element, Device> where Element : NumericType, Device : DeviceTypeParametersvectorTensor to apply weight decay on lossWeight decay importance scaling factor 
- 
                  
                  Computes the L2 loss of the given tensor. DeclarationSwift public func l2loss<Element, Device>(_ vector: Tensor<Element, Device>, loss: Element) -> Tensor<Element, Device> where Element : NumericType, Device : DeviceTypeParametersvectorTensor to apply weight decay on lossWeight decay importance scaling factor 
 View on GitHub
            View on GitHub
           Loss Functions  Reference
      Loss Functions  Reference