Skip to content

Instantly share code, notes, and snippets.

@dhgrs
Created August 21, 2018 14:36
Show Gist options
  • Save dhgrs/ca552f5804ddfb4db9669f9189eba76f to your computer and use it in GitHub Desktop.
Save dhgrs/ca552f5804ddfb4db9669f9189eba76f to your computer and use it in GitHub Desktop.
import tensorflow as tf
from tensorflow.keras.layers import Conv1D
class CausalConv(tf.keras.Model):
def __init__(self):
super(CausalConv, self).__init__()
self.conv = Conv1D(filters=16, kernel_size=2, padding='causal')
def call(self, x):
return self.conv(x)
x = tf.zeros([1, 128, 1])
model = CausalConv()
y = model(x)
print('input shape:', x.shape)
print('output shape:', y.shape)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment