You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a quick introduction - PlaidML is a backend that can be used to allow GPU-based learning on different hardware (in my case, a Mac with an AMD GPU). If I use PlaidML as a backend:
import os
os.environ["KERAS_BACKEND"] = "plaidml.keras.backend"
from keras import backend as K
from keras import activations, ini
And then attempt to use the the DenseVariational layer:
I get the following error when constructing a sequential model:
model.add(DenseVariational(1, kl_loss_weight=kl_loss_weight, activation='sigmoid'))
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/tensor_util.py", line 541, in make_tensor_proto
str_values = [compat.as_bytes(x) for x in proto_values]
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/tensor_util.py", line 541, in
str_values = [compat.as_bytes(x) for x in proto_values]
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/util/compat.py", line 71, in as_bytes
(bytes_or_text,))
TypeError: Expected binary or unicode string, got <tile.Value dense_variational_1/dense_variational_2/dense_variational_3/dense_variational_4/dense_variational_5/dense_variational_6/dense_variational_7/dense_variational_8/dense_variational_9/dense_variational_10/dense_variational_11/dense_variational_12/dense_variational_13/dense_variational_14/dense_variational_15/dense_variational_16/dense_variational_17/dense_variational_18/dense_variational_19/dense_variational_20/dense_variational_21/dense_variational_22/dense_variational_23/dense_variational_24/dense_variational_25/dense_variational_26/dense_variational_27/dense_variational_28/dense_variational_29/kernel_rho Tensor FLOAT32(512, 1)>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.7/site-packages/keras/engine/sequential.py", line 181, in add
output_tensor = layer(self.outputs[0])
File "/usr/local/lib/python3.7/site-packages/keras/engine/base_layer.py", line 457, in call
output = self.call(inputs, **kwargs)
File "", line 17, in call
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_nn_ops.py", line 11532, in softplus
"Softplus", features=features, name=name)
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py", line 531, in _apply_op_helper
raise err
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py", line 528, in _apply_op_helper
preferred_dtype=default_dtype)
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1297, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 286, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 227, in constant
allow_broadcast=True)
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 265, in _constant_impl
allow_broadcast=allow_broadcast))
File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/tensor_util.py", line 545, in make_tensor_proto
"supported type." % (type(values), values))
TypeError: Failed to convert object of type <class 'plaidml.tile.Value'> to Tensor. Contents: dense_variational_1/dense_variational_2/dense_variational_3/dense_variational_4/dense_variational_5/dense_variational_6/dense_variational_7/dense_variational_8/dense_variational_9/dense_variational_10/dense_variational_11/dense_variational_12/dense_variational_13/dense_variational_14/dense_variational_15/dense_variational_16/dense_variational_17/dense_variational_18/dense_variational_19/dense_variational_20/dense_variational_21/dense_variational_22/dense_variational_23/dense_variational_24/dense_variational_25/dense_variational_26/dense_variational_27/dense_variational_28/dense_variational_29/kernel_rho Tensor FLOAT32(512, 1). Consider casting elements to a supported type.
This may just come with the package if the underlying issue is similar to here, but is there any way to make these layers function without tying them so close to Tensorflow directly?
The text was updated successfully, but these errors were encountered:
Unfortunately, the Keras backend API doesn't provide probability distributions needed here such as tf.distributions.Normal. I could implement them low-level but this wouldn't really scale to more complex distributions. OTOH, tf.random.normal, for example, could be replaced by K.random_normal. If PlaidML has an API for probability distributions, the code should be rather straightforward to migrate I think (but I must admit I have no experience with PlaidML).
Just a quick introduction - PlaidML is a backend that can be used to allow GPU-based learning on different hardware (in my case, a Mac with an AMD GPU). If I use PlaidML as a backend:
And then attempt to use the the DenseVariational layer:
I get the following error when constructing a sequential model:
This may just come with the package if the underlying issue is similar to here, but is there any way to make these layers function without tying them so close to Tensorflow directly?
The text was updated successfully, but these errors were encountered: