12#include <drjit/math.h>
29 return sqrError * invC2;
42 return drjit::sqrt(L2Loss(sqrError, invC2) + T(1)) - T(1);
47 return T(0.5) * invC2 / drjit::sqrt(L2Loss(sqrError, invC2) + T(1));
53 return drjit::log(T(0.5) * L2Loss(sqrError, invC2) + T(1));
58 return invC2 / (invC2 * sqrError + T(2));
64 return T(1) - drjit::exp(T(-0.5) * L2Loss(sqrError, invC2));
69 return (T(0.5) * invC2) * drjit::exp(T(-0.5) * L2Loss(sqrError, invC2));
84 return L2Loss(sqrError, this->
invC2_);
86 return L1Loss(sqrError, this->
invC2_);
88 return CauchyLoss(sqrError, this->
invC2_);
91 return WelschLoss(sqrError, this->
invC2_);
97 L2Loss(sqrError, this->
invC2_) / std::fabs(this->
alpha_ - T(2)) + T(1),
107 return drjit::zeros<Packet<T>>();
118 return derivL2Loss(sqrError, this->
invC2_);
120 return derivL1Loss(sqrError, this->
invC2_);
122 return derivCauchyLoss(sqrError, this->
invC2_);
124 return derivWelschLoss(sqrError, this->
invC2_);
127 return (T(0.5) * this->
invC2_) *
129 L2Loss(sqrError, this->
invC2_) / std::fabs(this->
alpha_ - T(2)) + T(1),
130 T(0.5) * this->
alpha_ - T(1));
134 return drjit::zeros<Packet<T>>();
const T invC2_
Stored as 1/c^2 (instead of c) as a small optimization, since the loss formulas use this quantity dir...
SIMD (vectorized) variant of GeneralizedLossT that operates on DrJit Packet<T> lanes instead of indiv...
Packet< T > value(const Packet< T > &sqrError) const
Returns the loss value for each lane of sqrError.
GeneralizedLossT< T > Base
SimdGeneralizedLossT(const T &a=Base::kL2, const T &c=T(1))
Constructs a SIMD generalized loss with shape a and scale c.
Packet< T > deriv(const Packet< T > &sqrError) const
Returns d(loss)/d(sqrError) for each lane of sqrError.
drjit::Packet< T, kSimdPacketSize > Packet
A fixed-size SIMD packet of kSimdPacketSize elements of type T.