Skip to content

Commit 6d1f106

Browse files
Johannes Ballécopybara-github
authored andcommitted
Adds missing copyright notices.
PiperOrigin-RevId: 445531928 Change-Id: Ia00efca37d927141b2969105a1dea72cec64cd60
1 parent 3090696 commit 6d1f106

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

models/toy_sources/compression_model.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2020 Google LLC. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
115
"""Base class for coding experiment."""
216

317
import abc

models/toy_sources/ntc.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2020 Google LLC. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
115
"""Nonlinear transform coding."""
216

317
import matplotlib.pyplot as plt
@@ -10,11 +24,6 @@
1024
tfpd = tfp.distributions
1125

1226

13-
@tf.custom_gradient
14-
def st_round(inputs):
15-
return tf.round(inputs), lambda dy: dy
16-
17-
1827
class NTCModel(compression_model.CompressionModel):
1928
"""Nonlinear transform coding model."""
2029

@@ -158,7 +167,7 @@ def perturb(inputs, dither, prior, offset):
158167
else:
159168
if guess_offset:
160169
offset += tfc.quantization_offset(prior)
161-
return st_round(inputs - offset) + offset
170+
return tfc.round_st(inputs, offset)
162171

163172
assert x.shape[-1] == self.ndim_source
164173
y = self.analysis(x)

models/toy_sources/vecvq.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2020 Google LLC. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
115
"""Variational entropy-constrained vector quantization."""
216

317
import tensorflow as tf

0 commit comments

Comments
 (0)