Skip to content

Commit

Permalink
[DOC] Document _preprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
f-dangel committed Jan 12, 2024
1 parent ef1f2e1 commit 959c495
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions curvlinops/experimental/activation_hessian.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ def _matvec_batch(
return hessian_vector_product(loss, [activation], x_list)

def _preprocess(self, x: ndarray) -> List[Tensor]:
"""Reshape the incoming vector into the activation shape and convert to PyTorch.
Args:
x: Vector in NumPy format onto which the linear operator is applied.
Returns:
Vector in PyTorch format. Has same shape as the activation.
"""
return [from_numpy(x).to(self._device).reshape(self._activation_shape)]


Expand Down

0 comments on commit 959c495

Please sign in to comment.