Hi there,
When running the train_step I’m getting the error:
<ipython-input-64-474817c30aec>:34 train_step *
J = total_cost(J_content, J_style, 10, 40)
<ipython-input-15-373dbbefb38e>:20 total_cost *
J = alpha * J_content + beta * J_style
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:1141 binary_op_wrapper
raise e
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:1125 binary_op_wrapper
return func(x, y, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/dispatch.py:201 wrapper
return target(*args, **kwargs)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:1447 _add_dispatch
return gen_math_ops.add_v2(x, y, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_math_ops.py:496 add_v2
"AddV2", x=x, y=y, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:506 _apply_op_helper
inferred_from[input_arg.type_attr]))
TypeError: Input 'y' of 'AddV2' Op has type float64 that does not match type float32 of argument 'x'.
It looks like it’s a type error when running J = total_cost(J_content, J_style, 10, 40)
When I check the type of J_content and J_style I see the following:
Tensor("mul_20:0", shape=(), dtype=float32)
Tensor("add_4:0", shape=(), dtype=float64)
I don’t think that’s what I should be expecting. From earlier cells (5.5.1 and 5.5.2 the returned tensor is a tensor representing the scalar content cost and scalar style cost respectively. e.g. tf.Tensor(0.008070096, shape=(), dtype=float32)
tf.Tensor(-7424263.731670428, shape=(), dtype=float64)
I can’t understand why when I calculate the content and style cost, I’m getting this strange tensor value. It might be that I’ve misinterpreted how to handle the generated_image input to the train_step?
a_G = vgg_model_outputs(generated_image)
or how to call compute style cost?
J_style = compute_style_cost(a_S, a_G)
Help appreciated! I’ve been stuck for a while…