Uncaught (in promise) TypeError: Cannot read property 'producer' of undefined
at e.
at tfjs-converter:17
at Object.next (tfjs-converter:17)
at o (tfjs-converter:17)
My model is from Keras.
Maybe because the version?
I'll appreciate it if you could give me some help. Thanks.
@Swocky can you share the model.json file?
If your model is from Keras, it is likely you need to use tf.loadLayersModel API instead of tf.laodGraphModel API.
In the model.json file, there should be a field 'format' that indicates whether it is a graph or layers model.
@Swocky can you share the model.json file?
If your model is from Keras, it is likely you need to use tf.loadLayersModel API instead of tf.laodGraphModel API.
In the model.json file, there should be a field 'format' that indicates whether it is a graph or layers model.
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
Uncaught (in promise) Error: Unknown layer: Lambda. This may be due to one of the following reasons:
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.
from keras.backend import int_shape
......
embedded_sequences = Reshape((int_shape(embedding_layer)[1], int_shape(embedding_layer)[2], 1))(embedding_layer)
......
You could expand dim without using expand_dims and Lambda layer.
Most helpful comment
@Swocky can you share the model.json file?
If your model is from Keras, it is likely you need to use tf.loadLayersModel API instead of tf.laodGraphModel API.
In the model.json file, there should be a field 'format' that indicates whether it is a graph or layers model.