Skip to content

Commit 97ab580

Browse files
Johannes Ballécopybara-github
authored andcommitted
Updates for 2.8.0 release.
PiperOrigin-RevId: 427379522 Change-Id: I5346a758e69670960ab0bf4abe6e99466a0c49e7
1 parent c20abdb commit 97ab580

19 files changed

+195
-130
lines changed

docs/api_docs/python/tfc/ContinuousBatchedEntropyModel.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ description: Batched entropy model for continuous random variables.
2020

2121
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
2222
<td>
23-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L33-L421">
23+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L33-L426">
2424
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
2525
View source on GitHub
2626
</a>
@@ -34,9 +34,10 @@ Batched entropy model for continuous random variables.
3434
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
3535
<code>tfc.ContinuousBatchedEntropyModel(
3636
prior=None, coding_rank=None, compression=False, stateless=False,
37-
expected_grads=False, tail_mass=(2 ** -8), range_coder_precision=12, dtype=None,
38-
prior_shape=None, cdf=None, cdf_offset=None, cdf_shapes=None,
39-
offset_heuristic=True, quantization_offset=None, laplace_tail_mass=0
37+
expected_grads=False, tail_mass=(2 ** -8), range_coder_precision=12,
38+
bottleneck_dtype=None, prior_shape=None, cdf=None, cdf_offset=None,
39+
cdf_shapes=None, offset_heuristic=True, quantization_offset=None,
40+
laplace_tail_mass=0
4041
)
4142
</code></pre>
4243

@@ -193,11 +194,11 @@ Integer. Precision passed to the range coding op.
193194
</td>
194195
</tr><tr>
195196
<td>
196-
`dtype`
197+
`bottleneck_dtype`
197198
</td>
198199
<td>
199-
`tf.dtypes.DType`. Data type of this entropy model (i.e. dtype of
200-
prior, decompressed values). Must be provided if `prior` is omitted.
200+
`tf.dtypes.DType`. Data type of bottleneck tensor.
201+
Defaults to `tf.keras.mixed_precision.global_policy().compute_dtype`.
201202
</td>
202203
</tr><tr>
203204
<td>
@@ -270,6 +271,13 @@ Laplace mixture for training stability. (experimental)
270271

271272
<tr>
272273
<td>
274+
`bottleneck_dtype`
275+
</td>
276+
<td>
277+
Data type of the bottleneck tensor.
278+
</td>
279+
</tr><tr>
280+
<td>
273281
`cdf`
274282
</td>
275283
<td>
@@ -298,13 +306,6 @@ Whether this entropy model is prepared for compression.
298306
</td>
299307
</tr><tr>
300308
<td>
301-
`dtype`
302-
</td>
303-
<td>
304-
Data type of this entropy model.
305-
</td>
306-
</tr><tr>
307-
<td>
308309
`expected_grads`
309310
</td>
310311
<td>
@@ -456,7 +457,7 @@ of calling this method if you don't expect the return value to change.
456457

457458
<h3 id="compress"><code>compress</code></h3>
458459

459-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L336-L371">View source</a>
460+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L340-L376">View source</a>
460461

461462
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
462463
<code>compress(
@@ -512,7 +513,7 @@ coding unit.
512513

513514
<h3 id="decompress"><code>decompress</code></h3>
514515

515-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L373-L407">View source</a>
516+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L378-L412">View source</a>
516517

517518
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
518519
<code>decompress(
@@ -568,7 +569,7 @@ self.prior_shape`.
568569

569570
<h3 id="get_config"><code>get_config</code></h3>
570571

571-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L409-L421">View source</a>
572+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L414-L426">View source</a>
572573

573574
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
574575
<code>get_config()
@@ -593,7 +594,7 @@ A JSON-serializable Python dict.
593594

594595
<h3 id="get_weights"><code>get_weights</code></h3>
595596

596-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_base.py#L339-L340">View source</a>
597+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_base.py#L340-L341">View source</a>
597598

598599
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
599600
<code>get_weights()
@@ -604,7 +605,7 @@ A JSON-serializable Python dict.
604605

605606
<h3 id="quantize"><code>quantize</code></h3>
606607

607-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L314-L334">View source</a>
608+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L317-L338">View source</a>
608609

609610
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
610611
<code>quantize(
@@ -657,7 +658,7 @@ A `tf.Tensor` containing the quantized values.
657658

658659
<h3 id="set_weights"><code>set_weights</code></h3>
659660

660-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_base.py#L342-L347">View source</a>
661+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_base.py#L343-L348">View source</a>
661662

662663
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
663664
<code>set_weights(
@@ -733,7 +734,7 @@ The original method wrapped such that it enters the module's name scope.
733734

734735
<h3 id="__call__"><code>__call__</code></h3>
735736

736-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L282-L312">View source</a>
737+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_batched.py#L284-L315">View source</a>
737738

738739
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
739740
<code>__call__(

docs/api_docs/python/tfc/ContinuousIndexedEntropyModel.md

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ description: Indexed entropy model for continuous random variables.
2121

2222
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
2323
<td>
24-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L30-L408">
24+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L30-L420">
2525
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
2626
View source on GitHub
2727
</a>
@@ -36,7 +36,8 @@ Indexed entropy model for continuous random variables.
3636
<code>tfc.ContinuousIndexedEntropyModel(
3737
prior_fn, index_ranges, parameter_fns, coding_rank, channel_axis=-1,
3838
compression=False, stateless=False, expected_grads=False, tail_mass=(2 ** -8),
39-
range_coder_precision=12, dtype=tf.float32, laplace_tail_mass=0
39+
range_coder_precision=12, bottleneck_dtype=None, prior_dtype=tf.float32,
40+
laplace_tail_mass=0
4041
)
4142
</code></pre>
4243

@@ -247,11 +248,19 @@ Integer. Precision passed to the range coding op.
247248
</td>
248249
</tr><tr>
249250
<td>
250-
`dtype`
251+
`bottleneck_dtype`
251252
</td>
252253
<td>
253-
`tf.dtypes.DType`. Data type of this entropy model (i.e. dtype of
254-
prior, decompressed values).
254+
`tf.dtypes.DType`. Data type of bottleneck tensor.
255+
Defaults to `tf.keras.mixed_precision.global_policy().compute_dtype`.
256+
</td>
257+
</tr><tr>
258+
<td>
259+
`prior_dtype`
260+
</td>
261+
<td>
262+
`tf.dtypes.DType`. Data type of prior and probability
263+
computations. Defaults to `tf.float32`.
255264
</td>
256265
</tr><tr>
257266
<td>
@@ -275,6 +284,13 @@ laplace mixture for training stability. (experimental)
275284

276285
<tr>
277286
<td>
287+
`bottleneck_dtype`
288+
</td>
289+
<td>
290+
Data type of the bottleneck tensor.
291+
</td>
292+
</tr><tr>
293+
<td>
278294
`cdf`
279295
</td>
280296
<td>
@@ -310,13 +326,6 @@ Whether this entropy model is prepared for compression.
310326
</td>
311327
</tr><tr>
312328
<td>
313-
`dtype`
314-
</td>
315-
<td>
316-
Data type of this entropy model.
317-
</td>
318-
</tr><tr>
319-
<td>
320329
`expected_grads`
321330
</td>
322331
<td>
@@ -380,6 +389,13 @@ Prior distribution, used for deriving range coding tables.
380389
</td>
381390
</tr><tr>
382391
<td>
392+
`prior_dtype`
393+
</td>
394+
<td>
395+
Data type of `prior`.
396+
</td>
397+
</tr><tr>
398+
<td>
383399
`prior_fn`
384400
</td>
385401
<td>
@@ -461,7 +477,7 @@ of calling this method if you don't expect the return value to change.
461477

462478
<h3 id="compress"><code>compress</code></h3>
463479

464-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L338-L369">View source</a>
480+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L349-L381">View source</a>
465481

466482
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
467483
<code>compress(
@@ -523,7 +539,7 @@ coding unit.
523539

524540
<h3 id="decompress"><code>decompress</code></h3>
525541

526-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L371-L397">View source</a>
542+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L383-L409">View source</a>
527543

528544
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
529545
<code>decompress(
@@ -577,7 +593,7 @@ dimension).
577593

578594
<h3 id="from_config"><code>from_config</code></h3>
579595

580-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L404-L408">View source</a>
596+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L416-L420">View source</a>
581597

582598
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
583599
<code>@classmethod</code>
@@ -591,7 +607,7 @@ Instantiates an entropy model from a configuration dictionary.
591607

592608
<h3 id="get_config"><code>get_config</code></h3>
593609

594-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L399-L402">View source</a>
610+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L411-L414">View source</a>
595611

596612
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
597613
<code>get_config()
@@ -602,7 +618,7 @@ Returns the configuration of the entropy model.
602618

603619
<h3 id="get_weights"><code>get_weights</code></h3>
604620

605-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_base.py#L339-L340">View source</a>
621+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_base.py#L340-L341">View source</a>
606622

607623
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
608624
<code>get_weights()
@@ -613,7 +629,7 @@ Returns the configuration of the entropy model.
613629

614630
<h3 id="quantize"><code>quantize</code></h3>
615631

616-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L320-L336">View source</a>
632+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L330-L347">View source</a>
617633

618634
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
619635
<code>quantize(
@@ -662,7 +678,7 @@ A `tf.Tensor` containing the quantized values.
662678

663679
<h3 id="set_weights"><code>set_weights</code></h3>
664680

665-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_base.py#L342-L347">View source</a>
681+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_base.py#L343-L348">View source</a>
666682

667683
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
668684
<code>set_weights(
@@ -738,7 +754,7 @@ The original method wrapped such that it enters the module's name scope.
738754

739755
<h3 id="__call__"><code>__call__</code></h3>
740756

741-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L277-L318">View source</a>
757+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/entropy_models/continuous_indexed.py#L286-L328">View source</a>
742758

743759
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
744760
<code>__call__(

docs/api_docs/python/tfc/GDN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ description: Generalized divisive normalization layer.
2525

2626
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
2727
<td>
28-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/gdn.py#L31-L461">
28+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/gdn.py#L41-L466">
2929
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
3030
View source on GitHub
3131
</a>
@@ -779,7 +779,7 @@ using a `keras.Metric.Mean`.
779779

780780
<h3 id="build"><code>build</code></h3>
781781

782-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/gdn.py#L330-L363">View source</a>
782+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/gdn.py#L336-L369">View source</a>
783783

784784
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
785785
<code>build(
@@ -868,7 +868,7 @@ one per output tensor of the layer).
868868

869869
<h3 id="compute_output_shape"><code>compute_output_shape</code></h3>
870870

871-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/gdn.py#L418-L419">View source</a>
871+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/gdn.py#L423-L424">View source</a>
872872

873873
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
874874
<code>compute_output_shape(
@@ -1007,7 +1007,7 @@ A layer instance.
10071007

10081008
<h3 id="get_config"><code>get_config</code></h3>
10091009

1010-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/gdn.py#L421-L461">View source</a>
1010+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/gdn.py#L426-L466">View source</a>
10111011

10121012
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
10131013
<code>get_config() -> Dict[str, Any]

docs/api_docs/python/tfc/GDNParameter.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ description: Nonnegative parameterization as needed for GDN parameters.
1717

1818
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
1919
<td>
20-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L169-L248">
20+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L186-L269">
2121
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
2222
View source on GitHub
2323
</a>
@@ -220,7 +220,7 @@ of calling this method if you don't expect the return value to change.
220220

221221
<h3 id="get_config"><code>get_config</code></h3>
222222

223-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L239-L248">View source</a>
223+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L260-L269">View source</a>
224224

225225
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
226226
<code>get_config() -> Dict[str, Any]
@@ -318,10 +318,12 @@ The original method wrapped such that it enters the module's name scope.
318318

319319
<h3 id="__call__"><code>__call__</code></h3>
320320

321-
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L225-L229">View source</a>
321+
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L240-L250">View source</a>
322322

323323
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
324-
<code>__call__() -> tf.Tensor
324+
<code>__call__(
325+
compute_dtype=None
326+
) -> tf.Tensor
325327
</code></pre>
326328

327329
Computes and returns the non-negative value as a `tf.Tensor`.

0 commit comments

Comments
 (0)