|
29 | 29 | from tensorflow.python.framework import ops |
30 | 30 | from tensorflow.python.framework import tensor_shape |
31 | 31 | from tensorflow.python.keras.engine import base_layer |
| 32 | +from tensorflow.python.keras.engine import input_spec |
32 | 33 | from tensorflow.python.ops import array_ops |
33 | | -from tensorflow.python.ops import functional_ops |
34 | 34 | from tensorflow.python.ops import init_ops |
| 35 | +from tensorflow.python.ops import functional_ops |
35 | 36 | from tensorflow.python.ops import math_ops |
36 | 37 | from tensorflow.python.ops import nn |
37 | 38 | from tensorflow.python.ops import random_ops |
@@ -468,14 +469,16 @@ def compress(self, inputs): |
468 | 469 | inputs = ops.convert_to_tensor(inputs) |
469 | 470 | if not self.built: |
470 | 471 | # 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) |
472 | 474 | if self.dtype is None: |
473 | 475 | self._dtype = inputs.dtype.base_dtype.name |
474 | 476 | self.build(inputs.shape) |
475 | 477 |
|
476 | 478 | # Check input assumptions set after layer building, e.g. input shape. |
477 | 479 | if not context.executing_eagerly(): |
478 | | - self._assert_input_compatibility(inputs) |
| 480 | + input_spec.assert_input_compatibility(self.input_spec, inputs, |
| 481 | + self.name) |
479 | 482 |
|
480 | 483 | ndim = self.input_spec.ndim |
481 | 484 | channel_axis = self._channel_axis(ndim) |
|
0 commit comments