Skip to content

Commit

Permalink
Perform a deep copy when copying pytrees
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Jun 30, 2023
1 parent be5afc8 commit 8de552e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/jaxsim/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def mutable(self: T, mutable: bool = True, validate: bool = False) -> T:
return self

def copy(self: T) -> T:
obj = jax.tree_util.tree_map(lambda leaf: leaf, self)
obj = copy.deepcopy(self)
obj._set_mutability(mutability=self._mutability())
return obj

Expand Down

0 comments on commit 8de552e

Please sign in to comment.