U ¤PÓhºã@sŠddlmZddlZddlmZmZddlmZdddddœd d „Zdddddœd d „Zdd ddddœdd„Z dd dddddœdd„Z dS)é)Ú annotationsN)ÚTensorÚnn)ÚSlidingWindowInfererzdict[str, list[Tensor]]zlist[str] | NoneÚNone)Ú head_outputsÚkeysÚreturncCsd|dkrt| ¡ƒ}|D]F}||}t|tƒr:|g||<qt|dtƒrVt|ƒ||<qtdƒ‚qdS)a¼ An in-place function. We expect ``head_outputs`` to be Dict[str, List[Tensor]]. Yet if it is Dict[str, Tensor], this func converts it to Dict[str, List[Tensor]]. It will be modified in-place. Args: head_outputs: a Dict[str, List[Tensor]] or Dict[str, Tensor], will be modifier in-place keys: the keys in head_output that need to have value type List[Tensor]. If not provided, will use head_outputs.keys(). NrzMThe output of network should be Dict[str, List[Tensor]] or Dict[str, Tensor].)ÚlistrÚ isinstancerÚ ValueError)rrÚkZvalue_k©rú]/home/dell461/cl/sdc2/HISourceFinder-master-l/src/monai/apps/detection/utils/predict_utils.pyÚensure_dict_value_to_list_s    rcsV|dkrtˆ ¡ƒ}‡fdd„|Dƒ}t t |¡¡}t|ƒdkrRtd|›dƒ‚dS)ai We expect the values in ``head_outputs``: Dict[str, List[Tensor]] to have the same length. Will raise ValueError if not. Args: head_outputs: a Dict[str, List[Tensor]] or Dict[str, Tensor] keys: the keys in head_output that need to have values (List) with same length. If not provided, will use head_outputs.keys(). Ncsg|]}tˆ|ƒ‘qSr)Úlen)Ú.0r ©rrrÚ 9sz1check_dict_values_same_length..éz>The values in the input dict should have the same length, Got Ú.)r rÚtorchÚuniqueÚtensorrr )rrZnum_output_levels_listÚnum_output_levelsrrrÚcheck_dict_values_same_length,s   rrz nn.Modulez list[Tensor])ÚimagesÚnetworkrr cCsh||ƒ}t|ttfƒrt|ƒSt||ƒ|dkr s  ÿ