(x, encoding)
return x
Condition the input on the encoding.

    Args:
      x: The [mb, length, channels] float tensor input.
      encoding: The [mb, encoding_length, channels] float tensor encoding.

    Returns:
      The output after broadcasting the encoding to x's shape and adding them.
Condition the input on the encoding.
Condition the input on the encoding .
def _condition(x, encoding):
    """Condition the input on the encoding.

    Args:
      x: The [mb, length, channels] float tensor input.
      encoding: The [mb, encoding_length, channels] float tensor encoding.

    Returns:
      The output after broadcasting the encoding to x's shape and adding them.
    """
    mb, length, channels = x.get_shape().as_list()
    enc_mb, enc_length, enc_channels = encoding.get_shape().as_list()
    assert enc_mb == mb
    assert enc_channels == channels

    encoding = tf.reshape(encoding, [mb, enc_length, 1, channels])
    x = tf.reshape(x, [mb, enc_length, -1, channels])
    x += encoding
    x = tf.reshape(x, [mb, length, channels])
    x.set_shape([mb, length, channels])
    return x
def _condition ( x , encoding ) : mb , length , channels = x . get_shape ( ) . as_list ( ) enc_mb , enc_length , enc_channels = encoding . get_shape ( ) . as_list ( ) assert enc_mb == mb assert enc_channels == channels encoding = tf . reshape ( encoding , [ mb , enc_length , 1 , channels ] ) x = tf . reshape ( x , [ mb , enc_length , - 1 , channels ] ) x += encoding x = tf . reshape ( x , [ mb , length , channels ] ) x . set_shape ( [ mb , length , channels ] ) return x