I am attempting to use a keras neural net in one of my Edward models, and running into trouble. Essentially I am taking a keras
Model and trying to apply it to an Edward
RandomVariable, which doesn’t seem to work.
From the documentation here this would be achieved simply:
from edward.models import Bernoulli, Normal from keras.layers import Dense z = Normal(loc=tf.zeros([N, d]), scale=tf.ones([N, d])) h = Dense(256, activation='relu')(z) x = Bernoulli(logits=Dense(28 * 28)(h))
however when I try I get the following error:
ValueError: Layer dense_1 was called with an input that isn't a symbolic tensor. Received type: <class 'abc.Normal'>. Full input: [<ed.RandomVariable 'Normal/' shape=(10, 4) dtype=float32>]. All inputs to the layer should be tensors.
It seems that
keras doesn’t play nice with
edward. Is there a work around?