[RLlib] JAXPolicy prep PR #2 (move get_activation_fn (backward-compatibly), minor fixes and preparations). (#13091)

This commit is contained in:
Sven Mika
2020-12-30 22:30:52 -05:00
committed by GitHub
parent 6a54897577
commit 8726521604
14 changed files with 108 additions and 21 deletions
+6 -1
View File
@@ -4,6 +4,7 @@ import os
import sys
from typing import Any, Optional
from ray.rllib.utils.deprecation import deprecation_warning
from ray.rllib.utils.typing import TensorStructType, TensorShape, TensorType
logger = logging.getLogger(__name__)
@@ -252,7 +253,7 @@ def get_variable(value,
return value
# TODO: (sven) move to models/utils.py
# Deprecated: Use rllib.models.utils::get_activation_fn instead.
def get_activation_fn(name: Optional[str] = None, framework: str = "tf"):
"""Returns a framework specific activation function, given a name string.
@@ -268,6 +269,10 @@ def get_activation_fn(name: Optional[str] = None, framework: str = "tf"):
Raises:
ValueError: If name is an unknown activation function.
"""
deprecation_warning(
"rllib/utils/framework.py::get_activation_fn",
"rllib/models/utils.py::get_activation_fn",
error=False)
if framework == "torch":
if name in ["linear", None]:
return None