diff --git a/tensordict/_td.py b/tensordict/_td.py index f27c6f3ac..2f67a025e 100644 --- a/tensordict/_td.py +++ b/tensordict/_td.py @@ -1246,8 +1246,8 @@ def _set_str( if not validated: value = self._validate_value(value, check_shape=True) if not inplace: - # if self.is_locked: - # raise RuntimeError(_LOCK_ERROR) + if self.is_locked: + raise RuntimeError(_LOCK_ERROR) self._tensordict[key] = value else: try: