Passed all the Unit test in the assignment, except the last one. Any suggestion and help?
UNIT TEST
Transformer_test(Transformer, create_look_ahead_mask, create_padding_mask)
ValueError Traceback (most recent call last)
in
1 # UNIT TEST
----> 2 Transformer_test(Transformer, create_look_ahead_mask, create_padding_mask)
~/work/W4A1/public_tests.py in Transformer_test(target, create_look_ahead_mask, create_padding_mask)
276 enc_padding_mask,
277 look_ahead_mask,
→ 278 dec_padding_mask
279 )
280
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
1010 with autocast_variable.enable_auto_cast_variables(
1011 self._compute_dtype_object):
→ 1012 outputs = call_fn(inputs, *args, **kwargs)
1013
1014 if self._activity_regularizer:
in call(self, input_sentence, output_sentence, training, enc_padding_mask, look_ahead_mask, dec_padding_mask)
56 # call self.decoder with the appropriate arguments to get the decoder output
57 # dec_output.shape == (batch_size, tar_seq_len, embedding_dim)
—> 58 dec_output, attention_weights = self.decoder(None, None, None, None, None)
59
60 # pass decoder output through a linear layer and softmax (~2 lines)
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
1010 with autocast_variable.enable_auto_cast_variables(
1011 self._compute_dtype_object):
→ 1012 outputs = call_fn(inputs, *args, **kwargs)
1013
1014 if self._activity_regularizer:
in call(self, x, enc_output, training, look_ahead_mask, padding_mask)
44 “”"
45
—> 46 seq_len = tf.shape(x)[1]
47 attention_weights = {}
48
/opt/conda/lib/python3.7/site-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
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py in shape_v2(input, out_type, name)
620 A Tensor
of type out_type
.
621 “”"
→ 622 return shape(input, name, out_type)
623
624
/opt/conda/lib/python3.7/site-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
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py in shape(input, name, out_type)
647 A Tensor
of type out_type
.
648 “”"
→ 649 return shape_internal(input, name, optimize=True, out_type=out_type)
650
651
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py in shape_internal(input, name, optimize, out_type)
675 if optimize and input_shape.is_fully_defined():
676 return constant(input_shape.as_list(), out_type, name=name)
→ 677 return gen_array_ops.shape(input, name=name, out_type=out_type)
678
679
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/gen_array_ops.py in shape(input, out_type, name)
9164 try:
9165 return shape_eager_fallback(
→ 9166 input, out_type=out_type, name=name, ctx=_ctx)
9167 except _core._SymbolicException:
9168 pass # Add nodes to the TensorFlow graph.
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/gen_array_ops.py in shape_eager_fallback(input, out_type, name, ctx)
9190 out_type = _dtypes.int32
9191 out_type = _execute.make_type(out_type, “out_type”)
→ 9192 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx, )
9193 _inputs_flat = [input]
9194 _attrs = (“T”, _attr_T, “out_type”, out_type)
/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/execute.py in args_to_matching_eager(l, ctx, allowed_dtypes, default_dtype)
272 if tensor is None:
273 tensor = ops.convert_to_tensor(
→ 274 t, dtype, preferred_dtype=default_dtype, ctx=ctx)
275
276 ret.append(tensor)
/opt/conda/lib/python3.7/site-packages/tensorflow/python/profiler/trace.py in wrapped(*args, **kwargs)
161 with Trace(trace_name, **trace_kwargs):
162 return func(*args, **kwargs)
→ 163 return func(*args, **kwargs)
164
165 return wrapped
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, dtype_hint, ctx, accepted_result_types)
1538
1539 if ret is None:
→ 1540 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
1541
1542 if ret is NotImplemented:
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_tensor_conversion_function(v, dtype, name, as_ref)
337 as_ref=False):
338 _ = as_ref
→ 339 return constant(v, dtype=dtype, name=name)
340
341
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in constant(value, dtype, shape, name)
263 “”"
264 return _constant_impl(value, dtype, shape, name, verify_shape=False,
→ 265 allow_broadcast=True)
266
267
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast)
274 with trace.Trace(“tf.constant”):
275 return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
→ 276 return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
277
278 g = ops.get_default_graph()
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
299 def _constant_eager_impl(ctx, value, dtype, shape, verify_shape):
300 “”“Implementation of eager constant.”“”
→ 301 t = convert_to_eager_tensor(value, ctx, dtype)
302 if shape is None:
303 return t
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in convert_to_eager_tensor(value, ctx, dtype)
96 dtype = dtypes.as_dtype(dtype).as_datatype_enum
97 ctx.ensure_initialized()
—> 98 return ops.EagerTensor(value, ctx.device_name, dtype)
99
100
ValueError: Attempt to convert a value (None) with an unsupported type (<class ‘NoneType’>) to a Tensor.