tfep.utils.math.batch_autograd_log_abs_det_J

tfep.utils.math.batch_autograd_log_abs_det_J(x, y, **grad_kwargs)[source]

Compute the batch log(abs(det(J))) of y w.r.t. x using torch.autograd.grad.

Note that for the determinant to make sense, x and y must be 2D tensors with identical dimensions.

Parameters:
  • x (torch.Tensor) – Shape (batch_size, N). Input.

  • y (torch.Tensor) – Shape (batch_size, N). Output.

  • **grad_kwargs – Keyword arguments for autograd.grad (e.g., create_graph, retain_graph).

Returns:

log_det_J – Shape (batch_size,).

Return type:

torch.Tensor