(self, data_length)
| 66 | |
| 67 | class ValidationLoss(Metric): |
| 68 | def __init__(self, data_length): |
| 69 | super(ValidationLoss, self).__init__() |
| 70 | self.clear() |
| 71 | self.data_length = data_length |
| 72 | pipeline_stages = context.get_auto_parallel_context("pipeline_stages") |
| 73 | per_stage_device_num = get_group_size() // pipeline_stages |
| 74 | stage_id = get_rank() // per_stage_device_num |
| 75 | self.is_last_stage = (stage_id == pipeline_stages - 1) |
| 76 | |
| 77 | def clear(self): |
| 78 | """Clear the internal evaluation result.""" |