| 878 | return predictions |
| 879 | |
| 880 | def preprocess_data(self, fn_index: int, inputs: List[Any], state: Dict[int, Any]): |
| 881 | block_fn = self.fns[fn_index] |
| 882 | dependency = self.dependencies[fn_index] |
| 883 | |
| 884 | if block_fn.preprocess: |
| 885 | processed_input = [] |
| 886 | for i, input_id in enumerate(dependency["inputs"]): |
| 887 | block: IOComponent = self.blocks[input_id] |
| 888 | if getattr(block, "stateful", False): |
| 889 | processed_input.append(state.get(input_id)) |
| 890 | else: |
| 891 | processed_input.append(block.preprocess(inputs[i])) |
| 892 | else: |
| 893 | processed_input = inputs |
| 894 | return processed_input |
| 895 | |
| 896 | def postprocess_data( |
| 897 | self, fn_index: int, predictions: List[Any], state: Dict[int, Any] |