def _hash_dtype_and_shape(dtype: tf.DType, shape: tf.TensorShape) -> int: if shape.rank is not None: # as_list is not defined on unknown tensorshapes return hash((dtype.name, tuple(shape.as_list()))) return hash((dtype.name, None))
def build(self, input_shape: tf.TensorShape): _, length, _ = input_shape.as_list() digits = shuffle_utils.quaternary_digits(length - 1) self.shuffled_indices = [self.shuffle(x, digits, self.level) for x in range(length)]
def _hash_dtype_and_shape(dtype: tf.DType, shape: tf.TensorShape) -> int: return hash((dtype.name, tuple(shape.as_list())))
def compute_output_shape(self, input_shape: tf.TensorShape) -> tf.TensorShape: return tf.TensorShape([*input_shape.as_list(), self.output_size])