Ok. Totally lost. I’m not even sure where to start. So I’m lost with Keras. Not well explained (or even at all in the lectures). I’m posting my error codes from the results of the code activation.
NotImplementedError Traceback (most recent call last)
in
28
29
—> 30 Emojify_V2_test(Emojify_V2)
in Emojify_V2_test(target)
20
21 maxLen = 4
—> 22 model = target((maxLen,), word_to_vec_map, word_to_index)
23
24 assert type(model) == Functional, “Make sure you have correctly created Model instance which converts "sentence_indices" into "X"”
in Emojify_V2(input_shape, word_to_vec_map, word_to_index)
45 X = Dense(units=5)(X)
46 # Add a softmax activation
—> 47 X = Activation(softmax)(X)
48 # Create Model instance which converts sentence_indices into X.
49 model = Model(embeddings,X)
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
924 if _in_functional_construction_mode(self, inputs, args, kwargs, input_list):
925 return self._functional_construction_call(inputs, args, kwargs,
→ 926 input_list)
927
928 # Maintains info about the Layer.call
stack.
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list)
1115 try:
1116 with ops.enable_auto_cast_variables(self._compute_dtype_object):
→ 1117 outputs = call_fn(cast_inputs, *args, **kwargs)
1118
1119 except errors.OperatorNotAllowedInGraphError as e:
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/layers/core.py in call(self, inputs)
425
426 def call(self, inputs):
→ 427 return self.activation(inputs)
428
429 def compute_output_shape(self, input_shape):
~/work/W2A2/emo_utils.py in softmax(x)
27 def softmax(x):
28 “”“Compute softmax values for each sets of scores in x.”“”
—> 29 e_x = np.exp(x - np.max(x))
30 return e_x / e_x.sum()
31
<array_function internals> in amax(*args, **kwargs)
/opt/conda/lib/python3.7/site-packages/numpy/core/fromnumeric.py in amax(a, axis, out, keepdims, initial, where)
2666 “”"
2667 return _wrapreduction(a, np.maximum, ‘max’, axis, None, out,
→ 2668 keepdims=keepdims, initial=initial, where=where)
2669
2670
/opt/conda/lib/python3.7/site-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
88 return reduction(axis=axis, out=out, **passkwargs)
89
—> 90 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
91
92
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in array(self)
846 “Cannot convert a symbolic Tensor ({}) to a numpy array.”
847 " This error may indicate that you’re trying to pass a Tensor to"
→ 848 " a NumPy call, which is not supported".format(self.name))
849
850 def len(self):
NotImplementedError: Cannot convert a symbolic Tensor (dense_7/BiasAdd:0) to a numpy array. This error may indicate that you’re trying to pass a Tensor to a NumPy call, which is not supported