feat: extend EpochMetric to support more compute_fn output types#3789
feat: extend EpochMetric to support more compute_fn output types#3789zongyang078 wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Just to be sure we also should check if the output values are as expected or correct after the computation.
There was a problem hiding this comment.
Added value verification for all output types — each test now checks that the result matches directly calling compute_fn on the concatenated data.
|
Hi! I’m working on issue #1757 for a course contribution and noticed this PR already covers the main source changes. I added value-checking tests on my fork for scalar tensor, vector tensor, tuple/list of tensors, and mapping outputs. These tests check the actual computed values, which seems related to the review comment about verifying output correctness. Test commit: Abhisri436@56345826 Would it be useful for me to adapt these tests into this PR or keep them as a separate reference? |
|
@Abhisri436 It's generally not a good Idea to implement the changes as an external pr until explicitly mentioned that the change if a future improvement or can be done separately :) |
Fixes #1757
Description:
Extends
EpochMetricto support more output types returned bycompute_fn, as requested in #1757.Previously,
compute_fncould only return scalar values (int/float). This PR adds support for:torch.Tensortuple/listof tensorsMapping(e.g. dict) of tensorsA
TypeErrorwith a clear message is raised for unsupported output types. The existingapply_to_typeutility is reused for distributed broadcasting of non-scalar results.Check list: