Does anyone can help me to understand why I got this error and how can I solve it, please.
ValueError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py in binary_op_wrapper(x, y)
1135 r_op = getattr(y, “r%s” % op_name)
→ 1136 out = r_op(x)
1137 if out == NotImplemented:/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py in r_binary_op_wrapper(y, x)
1154 with ops.name_scope(None, op_name, [x, y]) as name:
→ 1155 x = ops.convert_to_tensor(x, dtype=y.dtype.base_dtype, name=“x”)
1156 return func(x, y, name=name)/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, dtype_hint, ctx, accepted_result_types)
1474 "Tensor conversion requested dtype %s for Tensor with dtype %s: r"
→ 1475 (dtype.name, value.dtype.name, value))
1476 return valueValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: <tf.Tensor: shape=(), dtype=float32, numpy=0.0>
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
in
2 a_S = tf.random.normal([1, 4, 4, 3], mean=1, stddev=4)
3 a_G = tf.random.normal([1, 4, 4, 3], mean=1, stddev=4)
----> 4 J_style_layer_GG = compute_layer_style_cost(a_G, a_G)
5 J_style_layer_SG = compute_layer_style_cost(a_S, a_G)
6in compute_layer_style_cost(a_S, a_G)
25
26 # Computing the loss (≈1 line)
—> 27 J_style_layer = tf.reduce_sum(tf.square(tf.subtract(GS, GG))) / (4 * tf.square(n_C) * tf.square(n_H * n_W))
28 #J_style_layer = None
29/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py in binary_op_wrapper(x, y)
1139 return out
1140 except (TypeError, ValueError):
→ 1141 raise e
1142 else:
1143 raise/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py in binary_op_wrapper(x, y)
1123 with ops.name_scope(None, op_name, [x, y]) as name:
1124 try:
→ 1125 return func(x, y, name=name)
1126 except (TypeError, ValueError) as e:
1127 # Even if dispatching the op failed, the RHS may be a tensor aware/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
199 “”“Call target, and fall back on dispatchers if there is a TypeError.”“”
200 try:
→ 201 return target(*args, **kwargs)
202 except (TypeError, ValueError):
203 # Note: convert_to_eager_tensor currently raises a ValueError, not a/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py in truediv(x, y, name)
1295 TypeError: Ifx
andy
have different dtypes.
1296 “”"
→ 1297 return _truediv_python3(x, y, name)
1298
1299/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py in _truediv_python3(x, y, name)
1226 if x_dtype != y_dtype:
1227 raise TypeError("x and y must have the same dtype, got %r != r"
→ 1228 (x_dtype, y_dtype))
1229 try:
1230 dtype = _TRUEDIV_TABLE[x_dtype]TypeError: x and y must have the same dtype, got tf.float32 != tf.int32
Thanks