I was trying my hands on neural style transfer and I encountered this error and I can’t seem to understand it.
InvalidArgumentError: {{function_node _wrapped__Einsum_N_2_device/job:localhost/replica:0/task:0/device:CPU:0}} Expected dimension 64 at axis 1 of the input shaped [1,409,512,64] but got dimension 409 [Op:Einsum]
Do the examples in this link on einsum help?
style_outputs = outputs[:NUM_STYLE_LAYERS]
gram_style_features = [gram_matrix(style_layer) for style_layer in style_outputs]
InvalidArgumentError: {{function_node _wrapped__Einsum_N_2_device/job:localhost/replica:0/task:0/device:CPU:0}} Expected dimension 64 at axis 1 of the input shaped [1,409,512,64] but got dimension 409 [Op:Einsum]
Any help ?
Adding @gent.spah who is a mentor for this course to help you.
@Benjamin_Appiah_Yebo, not sure how much this will help, but it looks like the 409 and 64 dimensions in the input shaped [1,409,512,64] got swapped around from what is expected. Can you trace back to see where those dimensions came from?
Those are the dimensions of the image.[quote=“Wendy, post:5, topic:255359, full:true”]
@Benjamin_Appiah_Yebo, not sure how much this will help, but it looks like the 4
Those are the dimensions of the
Your second dimension is not right it should be 64, I am guessing when you are creating the image tensors (if there are images involved) or maybe some other operation that is expanding the dimensions (like tf.expand…) you are not doing that operation right.
As Wendy suggests trace that back upwards in the cell where you obtain those batched tensors, there is where the problem most probably is.