diff --git a/aesara/link/utils.py b/aesara/link/utils.py index 4fac5e9d0b..b625e06138 100644 --- a/aesara/link/utils.py +++ b/aesara/link/utils.py @@ -730,9 +730,9 @@ def fgraph_to_python( if order is None: order = fgraph.toposort() - input_storage, output_storage, storage_map = map_storage( - fgraph, order, input_storage, output_storage, storage_map - ) + + if input_storage is None or output_storage is None or storage_map is None: + input_storage, output_storage, storage_map = map_storage(fgraph, order) unique_name = unique_name_generator([fgraph_name])