Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@HyeSungP
Copy link
Contributor

@HyeSungP HyeSungP commented Apr 4, 2025

Implement #3352

Check list:

  • Add above code
  • Add a test checking that error is raised to

@github-actions github-actions bot added the module: metrics Metrics module label Apr 4, 2025
@HyeSungP HyeSungP changed the title Output transform Add output_transform type check in Metric class (#3352) Apr 4, 2025
@HyeSungP HyeSungP changed the title Add output_transform type check in Metric class (#3352) Add output_transform type check in Metric class (pytorch#3352) Apr 4, 2025
@HyeSungP HyeSungP changed the title Add output_transform type check in Metric class (pytorch#3352) Add output_transform type check in Metric class (#3352) Apr 4, 2025
@vfdev-5 vfdev-5 mentioned this pull request Apr 5, 2025
1 task
y_pred = torch.tensor([[2.0], [-2.0]])
y = torch.zeros(2)
with pytest.raises(TypeError, match="Argument output_transform should be callable"):
DummyMetric1(true_output=(y_pred, y), output_transform=1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can probably set treu output to none. But ok to have it this way.

Copy link
Collaborator

@vfdev-5 vfdev-5 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 @HyeSungP !

@vfdev-5 vfdev-5 merged commit 0f0061c into pytorch:master Apr 6, 2025
17 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: metrics Metrics module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants