Skip to content

Instantly share code, notes, and snippets.

@flowpoint
Created October 10, 2018 11:33
Show Gist options
  • Save flowpoint/ae2d665b0606694dcb635b5074d078ed to your computer and use it in GitHub Desktop.
Save flowpoint/ae2d665b0606694dcb635b5074d078ed to your computer and use it in GitHub Desktop.
causal conv eager issue keras tensorflow
import tensorflow as tf
#import keras # works, but wants tf.contrib.eager.Variable for eager execution somewhere
from tensorflow import keras # <- errors on padding='causal'
import numpy as np
#tf.enable_eager_execution() #
data = np.random.random([1,1,256])
leaky_relu = tf.nn.leaky_relu
model = keras.Sequential([
keras.layers.Conv1D(16, 2, padding='causal', dilation_rate=2, activation=leaky_relu) ])
opt = tf.train.AdamOptimizer()
model.compile(opt, loss = 'mean_squared_error', metrics=['accuracy'])
model.fit(data, y=np.random.random([1,1,16]), batch_size=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment