mirror of
https://github.com/wassname/ray.git
synced 2026-09-12 12:51:15 +08:00
[RLlib] Nested action space PR (minimally invasive; torch only + test). (#8101)
- Add TorchMultiActionDistribution class. - Add framework-agnostic test cases for TorchMultiActionDistribution.
This commit is contained in:
+12
-4
@@ -14,8 +14,6 @@ from ray.rllib.utils.policy_server import PolicyServer
|
||||
from ray.rllib.utils.schedules import LinearSchedule, PiecewiseSchedule, \
|
||||
PolynomialSchedule, ExponentialSchedule, ConstantSchedule
|
||||
from ray.rllib.utils.test_utils import check, framework_iterator
|
||||
from ray.rllib.utils.torch_ops import convert_to_non_torch_type, \
|
||||
convert_to_torch_tensor
|
||||
from ray.tune.utils import merge_dicts, deep_update
|
||||
|
||||
|
||||
@@ -58,12 +56,21 @@ def force_list(elements=None, to_tuple=False):
|
||||
|
||||
force_tuple = partial(force_list, to_tuple=True)
|
||||
|
||||
|
||||
# TODO(sven): remove at some point.
|
||||
def try_import_tree():
|
||||
try:
|
||||
import tree
|
||||
return tree
|
||||
except (ImportError, ModuleNotFoundError):
|
||||
raise ModuleNotFoundError(
|
||||
"`dm-tree` is not installed! Run `pip install dm-tree`.")
|
||||
|
||||
|
||||
__all__ = [
|
||||
"add_mixins",
|
||||
"check",
|
||||
"check_framework",
|
||||
"convert_to_non_torch_type",
|
||||
"convert_to_torch_tensor",
|
||||
"deprecation_warning",
|
||||
"fc",
|
||||
"force_list",
|
||||
@@ -83,6 +90,7 @@ __all__ = [
|
||||
"try_import_tf",
|
||||
"try_import_tfp",
|
||||
"try_import_torch",
|
||||
"try_import_tree",
|
||||
"ConstantSchedule",
|
||||
"DeveloperAPI",
|
||||
"ExponentialSchedule",
|
||||
|
||||
Reference in New Issue
Block a user