AttributeError: in user code:
File "<ipython-input-28-02fe63a6c6d3>", line 20, in train_step *
J_style = compute_layer_style_cost(a_S, a_G)
File "<ipython-input-10-8b5b8a52639e>", line 16, in compute_layer_style_cost *
_, n_H, n_W, n_C = a_G.get_shape().as_list()
AttributeError: 'list' object has no attribute 'get_shape'
Here is the code:
# Compute a_G as the vgg_model_outputs for the current generated image
#(1 line)
a_G = vgg_model_outputs(generated_image)
# Compute the style cost
#(1 line)
J_style = compute_layer_style_cost(a_S, a_G)
âvgg_model_outputs(generated_image)â returns a list of tensors, but âcompute_layer_style_costâ function expects âa_Gâ to be a tensor of dimension (1, n_H, n_W, n_C).
Please let me know if you see how to resolve it. The help is highly appreciated!
AttributeError: in user code:
File "<ipython-input-27-02fe63a6c6d3>", line 20, in train_step *
J_style = compute_layer_style_cost(a_S, a_G)
File "<ipython-input-10-c155c320cd90>", line 16, in compute_layer_style_cost *
_, n_H, n_W, n_C = a_G.shape.as_list()
AttributeError: 'list' object has no attribute 'shape'
The problem is âcompute_layer_style_costâ function expects âa_Gâ to be a tensor of dimension (1, n_H, n_W, n_C), but the returned a_G = vgg_model_outputs(generated_image) is a list of tensors:
The problem is that you should not be calling compute_style_layer_cost directly from train_step. That is the bug. Notice that there is the function compute_style_cost that handles looping over the various layers and calling compute_style_layer_cost for each layer.