Last active
February 1, 2018 14:49
-
-
Save flowpoint/f04e845838db6a9ab0cbbe68ad3ba5a3 to your computer and use it in GitHub Desktop.
tensorflow atrous conv1d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def atrous_conv1d(value, filters, rate, padding, name=None): | |
'''wrapper for tf.nn.convolution to atrous_conv1d | |
lets you choose the filters | |
usage: | |
b = tf.placeholder(shape=(None, 1, 4096,1), dtype=tf.float32) | |
atrous_conv1d(b, filters=tf.ones((1, 4096, 1)),rate=2, padding='VALID') | |
b = tf.placeholder(shape=(None, 4096), dtype=tf.float32) | |
atrous_conv1d(b, filters=tf.ones((1, 4096, 1)),rate=2, padding='VALID') | |
correctness not guaranteed''' | |
return tf.squeeze(tf.nn.convolution( | |
input=tf.expand_dims(value,1), | |
filter=tf.expand_dims(filters,1), | |
padding=padding, | |
dilation_rate=np.broadcast_to(rate, (2,)), | |
name=name), 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment