mirror of
https://github.com/wassname/ray.git
synced 2026-09-09 11:32:43 +08:00
[RLlib] JAXPolicy prep PR #2 (move get_activation_fn (backward-compatibly), minor fixes and preparations). (#13091)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user