def _create_uncollate_postprocessors(self, stage: RunningStage) -> _PostProcessor: save_per_sample = None save_fn = None postprocess: Postprocess = self._postprocess_pipeline func_names: Dict[str, str] = { k: self._resolve_function_hierarchy(k, postprocess, stage, object_type=Postprocess) for k in self.POSTPROCESS_FUNCS } # since postprocessing is exclusive for prediction, we don't have to check the resolution hierarchy here. if postprocess._save_path: save_per_sample: bool = self._is_overriden_recursive( "save_sample", postprocess, Postprocess, prefix=_STAGES_PREFIX[stage] ) if save_per_sample: save_per_sample: Callable = getattr(postprocess, func_names["save_sample"]) else: save_fn: Callable = getattr(postprocess, func_names["save_data"]) return _PostProcessor( getattr(postprocess, func_names["uncollate"]), getattr(postprocess, func_names["per_batch_transform"]), getattr(postprocess, func_names["per_sample_transform"]), serializer=self._serializer, save_fn=save_fn, save_per_sample=save_per_sample )
def _create_uncollate_postprocessors(self) -> _PostProcessor: save_per_sample = None save_fn = None # since postprocessing is exclusive for prediction, we don't have to check the resolution hierarchy here. if self._postprocess_pipeline._save_path: save_per_sample = self._is_overriden('save_sample', self._postprocess_pipeline, Postprocess) if save_per_sample: save_per_sample = self._postprocess_pipeline._save_sample else: save_fn = self._postprocess_pipeline._save_data return _PostProcessor(self._postprocess_pipeline.uncollate, self._postprocess_pipeline.per_batch_transform, self._postprocess_pipeline.per_sample_transform, save_fn=save_fn, save_per_sample=save_per_sample)