From 76cb8ea50b0e4e474f77e8157eb06aa0238d4fd3 Mon Sep 17 00:00:00 2001 From: wilsonm Date: Fri, 30 Apr 2021 11:40:39 +0100 Subject: [PATCH] flatten out the inner layers in model_to_load --- anvil/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/anvil/models.py b/anvil/models.py index 14206b2..89abf45 100644 --- a/anvil/models.py +++ b/anvil/models.py @@ -248,7 +248,12 @@ def model_to_load(_normalising_flow): ``anvil-train`` will also provide the same information. """ - return layers.Sequential(*_normalising_flow) + # assume that _normalising_flow is a list of layers, each layer + # is a sequential of blocks, each block is a pair of transformations + # which transforms the entire input state - flatten this out, so output + # is Sequential of blocks + flow_flat = [block for layer in _normalising_flow for block in layer] + return layers.Sequential(*flow_flat) # Update docstring above if you add to this! LAYER_OPTIONS = {