Skip to content

Commit 44e0251

Browse files
GooglerJohannes Ballé
authored andcommitted
Project import generated by Copybara.
PiperOrigin-RevId: 239211896
1 parent 7b18a54 commit 44e0251

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tensorflow_compression/python/layers/entropy_models.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
from tensorflow.python.framework import ops
3030
from tensorflow.python.framework import tensor_shape
3131
from tensorflow.python.keras.engine import base_layer
32+
from tensorflow.python.keras.engine import input_spec
3233
from tensorflow.python.ops import array_ops
33-
from tensorflow.python.ops import functional_ops
3434
from tensorflow.python.ops import init_ops
35+
from tensorflow.python.ops import functional_ops
3536
from tensorflow.python.ops import math_ops
3637
from tensorflow.python.ops import nn
3738
from tensorflow.python.ops import random_ops
@@ -468,14 +469,16 @@ def compress(self, inputs):
468469
inputs = ops.convert_to_tensor(inputs)
469470
if not self.built:
470471
# Check input assumptions set before layer building, e.g. input rank.
471-
self._assert_input_compatibility(inputs)
472+
input_spec.assert_input_compatibility(self.input_spec, inputs,
473+
self.name)
472474
if self.dtype is None:
473475
self._dtype = inputs.dtype.base_dtype.name
474476
self.build(inputs.shape)
475477

476478
# Check input assumptions set after layer building, e.g. input shape.
477479
if not context.executing_eagerly():
478-
self._assert_input_compatibility(inputs)
480+
input_spec.assert_input_compatibility(self.input_spec, inputs,
481+
self.name)
479482

480483
ndim = self.input_spec.ndim
481484
channel_axis = self._channel_axis(ndim)

0 commit comments

Comments
 (0)