Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deprecation] Deprecate default num_cells in MLP #2395

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
init
  • Loading branch information
vmoens committed Aug 13, 2024
commit 97fcb9d4b13a3534259eec522a0e2984ec66f2c7
10 changes: 9 additions & 1 deletion torchrl/modules/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import annotations

import dataclasses
import warnings

from copy import deepcopy
from numbers import Number
Expand Down Expand Up @@ -179,8 +180,15 @@ def __init__(
if out_features is None:
raise ValueError("out_features must be specified for MLP.")

default_num_cells = 32
if num_cells is None:
warnings.warn(
"The current behaviour of MLP when not providing `num_cells` is that the number of cells is "
"set to [default_num_cells] * depth, where `depth=3` by default and `default_num_cells=0`. "
"From v0.7, this behaviour will switch and `depth=0` will be used. "
"To silence tis message, indicate what number of cells you desire.",
category=DeprecationWarning,
)
default_num_cells = 32
if depth is None:
num_cells = [default_num_cells] * 3
depth = 3
Expand Down
Loading