Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keras support #4

Open
twiecki opened this issue May 8, 2017 · 2 comments
Open

keras support #4

twiecki opened this issue May 8, 2017 · 2 comments

Comments

@twiecki
Copy link

twiecki commented May 8, 2017

Are there plans to add keras support to gelato?

@ferrine
Copy link
Owner

ferrine commented May 8, 2017

I think not in nearest future. I've just tried to check if it is supported out of the box but keras seems to force .eval() every symbolic weight.

CC @fchollet

%env KERAS_BACKEND=theano
import keras
from keras.layers import Dense, Activation
from keras.models import Sequential
import pymc3 as pm
from gelato.specs import NormalSpec, LognormalSpec

# create prior spec
hyper = LognormalSpec(sd=1).with_shape(())
init = NormalSpec(sd=hyper)
# create model
model = Sequential()
# try to init keras layer with gelato spec -> fail
with pm.Model():
    model.add(Dense(kernel_initializer=init, bias_initializer=init, units=64, input_dim=100))

----------
/usr/local/lib/python3.4/dist-packages/keras/backend/theano_backend.py in variable(value, dtype, name)
    141                               theano.tensor.TensorConstant)):
    142             # Support for RandomStreams().normal(), .uniform().
--> 143             value = value.eval()
MissingInputError: Undeclared input

@ferrine
Copy link
Owner

ferrine commented May 8, 2017

I've opened an issue there, hope it can be supported by Keras

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants