+
Skip to content

Conversation

Xmaster6y
Copy link
Contributor

Description

Enable LineariseRewards to work with negative weights.

Motivation and Context

Fixes #3063.

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

What types of changes does your code introduce? Remove all that do not apply:

  • New feature (non-breaking change which adds core functionality)

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.

Copy link

pytorch-bot bot commented Jul 13, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/3064

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures, 1 Pending, 5 Unrelated Failures

As of commit 88ceb99 with merge base 523ba2e (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 13, 2025
Copy link
Collaborator

@vmoens vmoens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@vmoens vmoens added the enhancement New feature or request label Jul 14, 2025
@vmoens vmoens merged commit 77c00b9 into pytorch:main Jul 14, 2025
93 of 102 checks passed
def test_weight_sign_error(self):
with pytest.raises(ValueError, match="Expected all weights to be >0"):
LineariseRewards(in_keys=("reward",), weights=-torch.ones(size=(2,)))
def test_weight_no_sign_error(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: its probably cleaner to remove this test now – it does not really test anything.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I allowed it as a non regression test but you could have said that of the previous one 😄

@Xmaster6y Xmaster6y deleted the linearise branch October 14, 2025 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Enable LineariseRewards to work with negative weights

4 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载