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 67a18f2 commit f8b5478
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 f8b5478

Please sign in to comment.