Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Implicitly cast input to tensor (e.g., tf.convert_to_tensor) in layer functions? #6979
In version <=2.0.4, Keras layers implicitly cast an input to a TensorFlow tensor as it goes through computation (it does this because the layer calls TensorFlow primitives which do the implicit casting).
A key application is the Edward probabilistic programming language. Consider a generative decoder:
from edward.models import Normal, Bernoulli from keras.layers import Dense batch_size = 128 latent_dim = 100 z = Normal(0.0, 1.0, sample_shape=[batch_size, latent_dim]) h = Dense(256)(z) x = Bernoulli(logits=h)
This works in Keras <=2.0.4 because the layer calls
Is the restriction to symbolic tensors (and not including implicitly castable tensors) on purpose?