Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens committed Aug 6, 2024
1 parent 76213f7 commit fdb8e12
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 @@ -48,7 +48,7 @@

from torchrl.data.tensor_specs import (
CompositeSpec,
NO_DEFAULT,
NO_DEFAULT_RL as NO_DEFAULT,
TensorSpec,
UnboundedContinuousTensorSpec,
)
Expand Down

0 comments on commit fdb8e12

Please sign in to comment.