-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught (in promise) TypeError: Cannot read property 'producer' of undefined #1432
Comments
@Swocky can you share the model.json file? |
You are right, I'm so casreless, as I used tf model before. But a new issue appears, I use a Lambda layer in my model, the result is
def __init__(
self, sequence_length, num_classes, vocab_size,
embedding_size, filter_sizes, num_filters, l2_reg_lambda=0.0):
# input layer
input_x = Input(shape=(sequence_length, ), dtype='int32')
# embedding layer
embedding_layer = Embedding(vocab_size,
embedding_size,
embeddings_initializer=random_uniform(minval=-1.0, maxval=1.0))(input_x)
embedded_sequences = Lambda(lambda x: expand_dims(x, -1))(embedding_layer) |
It seems that Lambda layer is not supported in tfjs. So I wonder if I have any alternative to expand my dim? |
I solved it by myself. Just use reshape.
You could expand dim without using expand_dims and Lambda layer. |
Uncaught (in promise) TypeError: Cannot read property 'producer' of undefined
at e. (tfjs-converter:17)
at tfjs-converter:17
at Object.next (tfjs-converter:17)
at o (tfjs-converter:17)
My model is from Keras.
<script> const MODEL_URL = './web_model/model.json'; async function predict(){ const model = await tf.loadGraphModel(MODEL_URL); const input_x = tf.tensor([[2714, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],shape=[1,50],dtype='int32'); const output = model.execute({input_x:input_x}); console.log(output); } predict(); </script><script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"> </script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script>
Maybe because the version?
I'll appreciate it if you could give me some help. Thanks.
The text was updated successfully, but these errors were encountered: