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.
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.
Note: This does not change the storage type of the embedding table, that will
continue to be float32 as will the saved variable in the checkpoint. You will
have to manually quantize the variable (typically with the same algorithm and
settings as above) manually.
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 2023-10-06 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2023-10-06 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[],[]]