dgs.utils.state.State.clean

State.clean(keys: list[str] | str | None = None) State[source]

Given a state, remove one or more keys to free up memory.

Parameters:

keys – The name of the keys to remove. If a key is not present in self.data, the key is ignored. If keys is None, the default keys ["image", "image_crop"] are removed. If keys is “all”, all keys that contain tensors are removed except for the bounding box.