last_output, outputs, states = K.rnn(step, x,
[],
mask=None)
return outputs
else:
raise Exception("Cannot apply softmax to a tensor that is not 2D or 3D. " +
"Here, ndim=" + str(ndim))
After Change
if ndim == 2:
return K.softmax(x)
elif ndim == 3:
e = K.exp(x)s = K.sum(e, axis=-1, keepdims=True)return e / s
else:
raise Exception("Cannot apply softmax to a tensor that is not 2D or 3D. " +
"Here, ndim=" + str(ndim))