Compute_layer_style_cost "Don't use numpy API"

I coded the compute_layer_style_cost function, and it looks like it gives me the correct output. However, it’s claiming I’m using numpy which causes some kind of problem. However, I’m not using numpy, so I have no idea what’s going on. Output is below

J_style_layer = tf.Tensor(14.017804, shape=(), dtype=float32)

Don’t use the numpy API inside compute_layer_style_cost

Failed to convert object of type <class ‘list’> to Tensor. Contents: [None, -1, 8]. Consider casting elements to a supported type.

1 Like

That error message about numpy is just a guess, since that’s one of the mistakes people make. My more educated guess :nerd_face: is that you’ve added an extra comma on the right hand side of one of the expressions, which results in the value being converted to a “tuple” or “list”. We’re not doing the “Sequential API” here any more.

It’s ok to take the hint from the grader with an appropriate dosage of salt, but the real value is in the actual error message from TF. It may seem pretty inscrutable at first glance. If it doesn’t make sense, then that’s where you need to spend more effort to decipher the meaning.