Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
vmoens committed Aug 6, 2024
2 parents 4dbd271 + d2af456 commit 9f8d0fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions torchrl/data/tensor_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from __future__ import annotations

import abc
import enum
import math
import warnings
from collections.abc import Iterable
Expand Down Expand Up @@ -81,6 +82,15 @@
)


# Akin to TD's NO_DEFAULT but won't raise a KeyError when found in a TD or used as default
class _NoDefault(enum.IntEnum):
ZERO = 0
ONE = 1


NO_DEFAULT_RL = _NoDefault.ONE


def _default_dtype_and_device(
dtype: Union[None, torch.dtype],
device: Union[None, str, int, torch.device],
Expand Down
2 changes: 1 addition & 1 deletion torchrl/envs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from torch.utils._pytree import tree_map
from torchrl._utils import _replace_last, _rng_decorator, logger as torchrl_logger

from torchrl.data.tensor_specs import Composite, NO_DEFAULT, TensorSpec, Unbounded
from torchrl.data.tensor_specs import Composite, NO_DEFAULT_RL as NO_DEFAULT, TensorSpec, Unbounded
from torchrl.data.utils import check_no_exclusive_keys

__all__ = [
Expand Down

0 comments on commit 9f8d0fc

Please sign in to comment.