Skip to content

Commit

Permalink
Change vmap randomness to 'same' as 'different' seems to be not suppo…
Browse files Browse the repository at this point in the history
…rted.
  • Loading branch information
Tim-Salzmann committed May 29, 2024
1 parent c135d4f commit 4394d56
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions l4casadi/realtime/sensitivities.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def batched_jacobian(func: Callable, inputs: torch.Tensor, create_graph=False, r
if inputs.shape[0] == 1:
vmap_randomness = 'same'
else:
vmap_randomness = 'different'
# https://github.com/pytorch/functorch/issues/996
# Should be 'different'
vmap_randomness = 'same'

if not create_graph:
with torch.no_grad():
Expand Down Expand Up @@ -65,7 +67,9 @@ def batched_hessian(func: Callable, inputs: torch.Tensor, create_graph=False,
if inputs.shape[0] == 1:
vmap_randomness = 'same'
else:
vmap_randomness = 'different'
# https://github.com/pytorch/functorch/issues/996
# Should be 'different'
vmap_randomness = 'same'

def aux_function_jac(func):
def inner_aux(inputs):
Expand Down

0 comments on commit 4394d56

Please sign in to comment.