From 56f20e40a2206bbb16501a0f600e29ce1b112ef1 Mon Sep 17 00:00:00 2001 From: StagOverflow <62816062+StagOverflow@users.noreply.github.com> Date: Tue, 27 Feb 2024 08:49:42 -0500 Subject: [PATCH] Fix `sum_independent_dims` docstring to reflect output shape (#1851) Co-authored-by: Heinrick Lumini --- docs/misc/changelog.rst | 3 ++- stable_baselines3/common/distributions.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/misc/changelog.rst b/docs/misc/changelog.rst index feb096a..5176c69 100644 --- a/docs/misc/changelog.rst +++ b/docs/misc/changelog.rst @@ -65,6 +65,7 @@ Documentation: - Updated export to ONNX documentation, it is now much simpler to export SB3 models with newer ONNX Opset! - Added video link to "Practical Tips for Reliable Reinforcement Learning" video - Added ``render_mode="human"`` in the README example (@marekm4) +- Fixed docstring signature for sum_independent_dims (@stagoverflow) Release 2.2.1 (2023-11-17) -------------------------- @@ -1565,4 +1566,4 @@ And all the contributors: @anand-bala @hughperkins @sidney-tio @AlexPasqua @dominicgkerr @Akhilez @Rocamonde @tobirohrer @ZikangXiong @ReHoss @DavyMorgan @luizapozzobon @Bonifatius94 @theSquaredError @harveybellini @DavyMorgan @FieteO @jonasreiher @npit @WeberSamuel @troiganto @lutogniew @lbergmann1 @lukashass @BertrandDecoster @pseudo-rnd-thoughts @stefanbschneider @kyle-he @PatrickHelm @corentinlger -@marekm4 +@marekm4 @stagoverflow diff --git a/stable_baselines3/common/distributions.py b/stable_baselines3/common/distributions.py index 149345d..132a353 100644 --- a/stable_baselines3/common/distributions.py +++ b/stable_baselines3/common/distributions.py @@ -113,7 +113,7 @@ def sum_independent_dims(tensor: th.Tensor) -> th.Tensor: so we can sum components of the ``log_prob`` or the entropy. :param tensor: shape: (n_batch, n_actions) or (n_batch,) - :return: shape: (n_batch,) + :return: shape: (n_batch,) for (n_batch, n_actions) input, scalar for (n_batch,) input """ if len(tensor.shape) > 1: tensor = tensor.sum(dim=1)