예제 #1
0
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))
예제 #2
0
 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)]
예제 #3
0
def _hash_dtype_and_shape(dtype: tf.DType, shape: tf.TensorShape) -> int:
    return hash((dtype.name, tuple(shape.as_list())))
예제 #4
0
 def compute_output_shape(self, input_shape: tf.TensorShape) -> tf.TensorShape:
     return tf.TensorShape([*input_shape.as_list(), self.output_size])