Hi,
I’ve been stuck on this for a while. I am getting the following error
NotImplementedError Traceback (most recent call last)
<ipython-input-86-bb78fe22f36c> in <module>
28
29
---> 30 Emojify_V2_test(Emojify_V2)
<ipython-input-86-bb78fe22f36c> 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\""
<ipython-input-85-f2660e0ebfeb> in Emojify_V2(input_shape, word_to_vec_map, word_to_index)
43 print('shape of X:', X.shape)
44 print('type of X:', type(X))
---> 45 X = softmax(X)
46
47 # Create Model instance which converts sentence_indices into X.
~/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_5/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
I printed what is being sent to softmax and shapes of X and see the following
input shape (4,)
shape of X: (None, 5)
type of X: <class 'tensorflow.python.framework.ops.Tensor'>
I’ve gone through the a similar error and its suggested solution but no luck. Appreciate some guidance on this.