tensorflow / tensorflow/model-optimization

Unsupported operations when applying tfmot

Open
#941 1 comment 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.6k
Forks
349
Avg merge
3d 2h
Merged PRs (30d)
1

Description

Hi, I'm trying to apply tfmot for an implementation of BiSeNetV2, when executing tfmot.quantization.keras.quantize_model, I meet errors with the following operations:

tf.reduce_mean: Layer tf.math.reduce_mean:<class 'tensorflow.python.keras.layers.core.TFOpLambda'> is not supported. You can quantize this layer by passing a tfmot.quantization.keras.QuantizeConfig instance to the quantize_annotate_layer API.
tf.nn.sigmoid: Exception has occurred: RuntimeError
Layer tf.math.sigmoid_1:<class 'tensorflow.python.keras.layers.core.TFOpLambda'> is not supported. You can quantize this layer by passing a tfmot.quantization.keras.QuantizeConfig instance to the quantize_annotate_layer API.

tf.image.resize: Exception has occurred: ValueError 'images' must have either 3 or 4 dimensions.

  1. For layer tf.reduce_mean and tf.nn.sigmoid, the class is tensorflow.python.keras.layers.core.TFOpLambda, and they are failed to be executed with tfmot.quantization.keras.QuantizeConfig. How to apply these layers to tfmot?
  2. How to effectively apply tf.image.resize to tfmot model?

The followings are the settings of TensorFlow:
TensorFlow-gpu 2.4.0
tensorflow-model-optimization 0.7.1

Best Regards,
Rahn

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.