# Course 04 W04 "Neural Style Transfer" programming assignment ISSUE

{image removed by moderator as it contained codes from grader cell}

1 Like

Please check the declaration/initialization of âxâ and âyâ variable.
Error is clearly showing the data type mismatch.

Firstly it is a request refrain from posting any codes related to grader cells, it is against community guidelines, doing so can revoke your membership in the discourse community.

1. The way you recalled below codes is incorrect
Reshape the tensors from (1, n_H, n_W, n_C) to (n_C, n_H * n_W) (â2 lines)
Notice the instruction given to right this code before the grader cell is
Unroll the hidden layer activations a_S and a_G into 2D matrices, as explained in the picture above (see the images in the sections âcomputing the content costâ and âstyle matrixâ).

Another important hint is
Since the activation dimensions are (m,nH,nW,nC) whereas the desired unrolled matrix shape is (nC, nHânW), the order of the filter dimension nC is changed. So tf.transpose can be used to change the order of the filter dimension.

So make you first use tf.reshape on the style image S and G with matrix shape, to this you need to use tf.transpose. Also there is also mention the order of filter dimension nC is changed, when you do the reshape mentioned nC first and then nH*nW

1. Next issue Computing gram_matrices for both images S and G (â2 lines)
Compute the Style matrix of the images S and G. (Use the function you had previously written.)
Gram matrix of the âstyleâ image(a_S)
Gram matrix of the âgeneratedâ image(a_G).

2. This code is totally incorrectly written
Computing the loss (â1 line)
Refer the below image to write the correct code

Your equation should begin with loss mentions first on the dimensions to which you multiple the tf.reduce_sum is used to the tf.pow of style matrix of images of S-G) of 2

Regards
DP