tfc.ops.create_range_encoder
Stay organized with collections
Save and categorize content based on your preferences.
Creates range encoder objects to be used by EntropyEncode*
ops.
tfc.ops.create_range_encoder(
shape, lookup, name=None
)
The output handle
has the shape specified by the input shape
. Each element
in handle
is an independent range encoder object, and EntropyEncode*
processes as many concurrent code streams as contained in handle
.
This op expects lookup
to be either a concatenation (1-D) or stack (2-D) of
CDFs, where each CDF is preceded by a corresponding precision value. In case of
a stack:
lookup[..., 0] = precision in [1, 16],
lookup[..., 1] / 2^precision = Pr(X < 0) = 0,
lookup[..., 2] / 2^precision = Pr(X < 1),
lookup[..., 3] / 2^precision = Pr(X < 2),
...
lookup[..., -1] / 2^precision = 1,
Subsequent values in each CDF may be equal, indicating a symbol with zero
probability. Attempting to encode such a symbol will result in undefined
behavior. However, any number of trailing zero-probability symbols will be
interpreted as padding, and attempting to use those will result in an encoding
error (unless overflow functionality is used).
Overflow functionality can be enabled by negating the precision value in
lookup
. In that case, the last non-zero probability symbol in the CDF is used
as an escape code, allowing negative integers and integers greater or equal to
the last non-zero probability symbol to be encoded using an Elias gamma code,
which is interleaved into the code stream. Attempting to encode a
zero-probability symbol within the valid range still causes undefined behavior.
Args |
shape
|
A Tensor of type int32 .
|
lookup
|
A Tensor of type int32 .
|
name
|
A name for the operation (optional).
|
Returns |
A Tensor of type variant .
|
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.
[[["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 2024-04-26 UTC."],[],[],null,["# tfc.ops.create_range_encoder\n\n\u003cbr /\u003e\n\nCreates range encoder objects to be used by `EntropyEncode*` ops.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tfc.create_range_encoder`](https://www.tensorflow.org/api_docs/python/tfc/ops/create_range_encoder)\n\n\u003cbr /\u003e\n\n tfc.ops.create_range_encoder(\n shape, lookup, name=None\n )\n\nThe output `handle` has the shape specified by the input `shape`. Each element\nin `handle` is an independent range encoder object, and `EntropyEncode*`\nprocesses as many concurrent code streams as contained in `handle`.\n\nThis op expects `lookup` to be either a concatenation (1-D) or stack (2-D) of\nCDFs, where each CDF is preceded by a corresponding precision value. In case of\na stack: \n\n lookup[..., 0] = precision in [1, 16],\n lookup[..., 1] / 2^precision = Pr(X \u003c 0) = 0,\n lookup[..., 2] / 2^precision = Pr(X \u003c 1),\n lookup[..., 3] / 2^precision = Pr(X \u003c 2),\n ...\n lookup[..., -1] / 2^precision = 1,\n\nSubsequent values in each CDF may be equal, indicating a symbol with zero\nprobability. Attempting to encode such a symbol will result in undefined\nbehavior. However, any number of trailing zero-probability symbols will be\ninterpreted as padding, and attempting to use those will result in an encoding\nerror (unless overflow functionality is used).\n\nOverflow functionality can be enabled by negating the precision value in\n`lookup`. In that case, the last non-zero probability symbol in the CDF is used\nas an escape code, allowing negative integers and integers greater or equal to\nthe last non-zero probability symbol to be encoded using an Elias gamma code,\nwhich is interleaved into the code stream. Attempting to encode a\nzero-probability symbol within the valid range still causes undefined behavior.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------|--------------------------------------|\n| `shape` | A `Tensor` of type `int32`. |\n| `lookup` | A `Tensor` of type `int32`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` of type `variant`. ||\n\n\u003cbr /\u003e"]]