xnn.krnn.fast.sgdml_kernels.energy_gradient#

xnn.krnn.fast.sgdml_kernels.energy_gradient(x, xp, wp, ec, kernel, gradient=True)[source]#

Energies (B,) and (with gradient) gradients (B, D) of the kernel expansion.

The same sums as xnn.krnn.models.sgdml.kernel_energy(), in two kernels: one forms the kernel factors of every pair of a structure and a training term, the other contracts them with the training terms.

Parameters:
Return type:

Tuple[Tensor, Tensor | None]