1

I am trying to quantize a model in tensorflow using tfmot.

This is a sample model,

inputs = keras.layers.Input(shape=(512, 512, 1))
x = keras.layers.Conv2D(3, kernel_size=1, padding='same')(inputs)
x = keras.layers.GlobalAveragePooling2D()(x)
outputs = keras.layers.Dense(4, activation='softmax')(x)
model = keras.Model(inputs=inputs, outputs=outputs)`

And i get the following error:

`ValueError: `to_annotate` can only be a `keras.layers.Layer` instance. 
 You passed an instance of type: Conv2D.`

I have tried to import "keras" from different source like tf.keras or tfmot or even tf_keras. None of them solved it and all say they want a keras.layers.Layer instance. I don't understand, how can i solve this?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.