diff --git a/python/model_utils.py b/python/model_utils.py index 16189c9..4a5d4be 100644 --- a/python/model_utils.py +++ b/python/model_utils.py @@ -72,10 +72,17 @@ def get_layer_activation(layer): def save_layer(layer): + try: + outshape = layer.output_shape # this is the original code, but sometimes doesn't work + except: + outshape = layer.output.shape # if not, use this and make sure it's a tuple so it can be JSON encoded + if type(outshape) != tuple: + outshape = tuple(outshape.as_list()) + layer_dict = { "type" : get_layer_type(layer), "activation" : get_layer_activation(layer), - "shape" : layer.output_shape, + "shape" : outshape, # modified to use the outshape above } if layer_dict["type"] == "conv1d":