Skip to content

Commit

Permalink
Make function to convert deprecated parameters robust to different ac…
Browse files Browse the repository at this point in the history
…tivation list lenghts
  • Loading branch information
Toni-SM committed Sep 6, 2024
1 parent 2607b2a commit ec1ab8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion skrl/utils/model_instantiators/jax/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,15 @@ def convert_deprecated_parameters(parameters: Mapping[str, Any]) -> Tuple[Mappin
logger.warning(f'The following parameters ({", ".join(list(parameters.keys()))}) are deprecated. '
"See https://skrl.readthedocs.io/en/latest/api/utils/model_instantiators.html")
# network definition
activations = parameters.get("hidden_activation", [])
if type(activations) in [list, tuple] and len(set(activations)) == 1:
activations = activations[0]
network = [
{
"name": "net",
"input": str(parameters.get("input_shape", "STATES")),
"layers": parameters.get("hiddens", []),
"activations": parameters.get("hidden_activation", []),
"activations": activations,
}
]
# output
Expand Down
5 changes: 4 additions & 1 deletion skrl/utils/model_instantiators/torch/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,15 @@ def convert_deprecated_parameters(parameters: Mapping[str, Any]) -> Tuple[Mappin
logger.warning(f'The following parameters ({", ".join(list(parameters.keys()))}) are deprecated. '
"See https://skrl.readthedocs.io/en/latest/api/utils/model_instantiators.html")
# network definition
activations = parameters.get("hidden_activation", [])
if type(activations) in [list, tuple] and len(set(activations)) == 1:
activations = activations[0]
network = [
{
"name": "net",
"input": str(parameters.get("input_shape", "STATES")),
"layers": parameters.get("hiddens", []),
"activations": parameters.get("hidden_activation", []),
"activations": activations,
}
]
# output
Expand Down

0 comments on commit ec1ab8a

Please sign in to comment.