[CODE SOLUTION REMOVED FROM MODERATOR]
OperatorNotAllowedInGraphError Traceback (most recent call last)
Input In [29], in <cell line: 7>()
1 ### you cannot edit this cell
2
3 # You always must run the last cell before this one. You will get an error if not.
5 generated_image = tf.Variable(generated_image)
----> 7 train_step_test(train_step, generated_image)
File /tf/W4A2/public_tests.py:86, in train_step_test(target, generated_image)
82 def train_step_test(target, generated_image):
83 generated_image = tf.Variable(generated_image)
—> 86 J1 = target(generated_image)
87 print(J1)
88 assert type(J1) == EagerTensor, f"Wrong type {type(J1)} != {EagerTensor}"
File /usr/local/lib/python3.8/dist-packages/tensorflow/python/util/traceback_utils.py:153, in filter_traceback..error_handler(*args, **kwargs)
151 except Exception as e:
152 filtered_tb = _process_traceback_frames(e.traceback)
→ 153 raise e.with_traceback(filtered_tb) from None
154 finally:
155 del filtered_tb
File /usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/func_graph.py:1127, in func_graph_from_py_func..autograph_handler(*args, **kwargs)
1125 except Exception as e: # pylint:disable=broad-except
1126 if hasattr(e, “ag_error_metadata”):
→ 1127 raise e.ag_error_metadata.to_exception(e)
1128 else:
1129 raise
OperatorNotAllowedInGraphError: in user code:
File "<ipython-input-28-f640a9aa7ccf>", line 19, in train_step *
J_style = compute_style_cost(a_S, a_G, STYLE_LAYERS=STYLE_LAYERS)
File "<ipython-input-16-7b56545257a6>", line 30, in compute_style_cost *
J_style_layer = compute_layer_style_cost(a_S[i], a_G[i])
File "<ipython-input-11-c1b045308fe7>", line 16, in compute_layer_style_cost *
_, n_H, n_W, n_C = tf.shape(a_G)
**OperatorNotAllowedInGraphError: Iterating over a symbolic `tf.Tensor` is not allowed: AutoGraph did convert this function. This might indicate you are trying to use an unsupported feature.**