TypeError: Eager execution of tf.constant with unsupported shape

Refresh

5 weeks ago

Views

3 time

0

I'm trying to modify the code from "Probabilistic_Layers_Regression.ipynb" for input_shape of 8 and output_shape of 8. I get the following error from the sample code below. Any ideas why? Thanks ----Error------ TypeError Traceback (most recent call last) in ()

11 dtype=x.dtype)[..., np.newaxis]),
12 unconstrained_observation_noise_variance_initializer=(
---> 13 tf.constant_initializer(np.array(0.54).astype(x.dtype))),
14 ),
15 ])

TypeError: Eager execution of tf.constant with unsupported shape (value has 40 elements, shape is (1, 40, 8) with 320 elem

Can't find much documentation on tfp.layers.VariationalGaussianProcess

num_inducing_points = 40
model = tf.keras.Sequential([
       tf.keras.layers.InputLayer(input_shape=[8], dtype=x.dtype), 
       tf.keras.layers.Dense(8, kernel_initializer='ones',            use_bias=False),
       tfp.layers.VariationalGaussianProcess(
          enter code herenum_inducing_points=num_inducing_points,
          kernel_provider=RBFKernelFn(dtype=x.dtype),
          event_shape=[1], #x.shape[1]],
       inducing_index_points_initializer=tf.constant_initializer(
          np.linspace(*x_range, num=num_inducing_points,
          dtype=x.dtype)[..., np.newaxis]),
       unconstrained_observation_noise_variance_initializer=(
          tf.constant_initializer(np.array(0.54).astype(x.dtype))),
 ),
])

Array of 8 elements rather than 1 for output

0 answers