tf.tpu.experimental.embedding.QuantizationConfig  |  TensorFlow v2.16.1 (original) (raw)

tf.tpu.experimental.embedding.QuantizationConfig

Stay organized with collections Save and categorize content based on your preferences.

Settings for simulated quantization of the tpu embedding table.

View aliases

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.tpu.experimental.embedding.QuantizationConfig

tf.tpu.experimental.embedding.QuantizationConfig(
    num_buckets: int, lower: float, upper: float
)

When simulated quantization is enabled, the results of the embedding lookup are clipped and quantized according to the settings here before the combiner is applied.

For example, to quantize input the following is done:

if input < lower
  input = lower
if input > upper
  input = upper
quantum = (upper - lower) / (num_buckets - 1)
input = math.floor((input - lower) / quantum + 0.5) * quantium + lower

See tensorflow/core/protobuf/tpu/optimization_parameters.proto for more details.

Args
num_buckets The number of quantization buckets, must be atleast 2.
lower The lower bound for the quantization range.
upper The upper bound for the quantization range.
Raises
ValueError if num_buckets is less than 2.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.