hipsternet icon indicating copy to clipboard operation
hipsternet copied to clipboard

Contractive autoencoder is not working

Open akhilkapil opened this issue 4 years ago • 0 comments

Hello, I am just trying to implement the contractive autoencoder but everytime I try to run it shows me this error:

Epoch 1/3

RuntimeError Traceback (most recent call last) in () ----> 1 contractiveAutoencoder(X_train)

10 frames /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in wrapper(*args, **kwargs) 984 except Exception as e: # pylint:disable=broad-except 985 if hasattr(e, "ag_error_metadata"): 986 raise e.ag_error_metadata.to_exception(e) 987 else: 988 raise

RuntimeError: in user code:

/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/training.py:855 train_function  *
    return step_function(self, iterator)
<ipython-input-5-80182a51a910>:15 contractive_loss  *
    W = tf.Variable(value=model.get_layer('encoded').get_weights()[0])  # N x N_hidden
/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/base_layer.py:1831 get_weights  **
    return backend.batch_get_value(output_weights)
/usr/local/lib/python3.7/dist-packages/tensorflow/python/util/dispatch.py:206 wrapper
    return target(*args, **kwargs)
/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/backend.py:3746 batch_get_value
    raise RuntimeError('Cannot get value inside Tensorflow graph function.')

RuntimeError: Cannot get value inside Tensorflow graph function.

'

I have tried many things to resolve this issues but i am unable to. Let me know if there is any solution for this.

akhilkapil avatar Jul 19 '21 07:07 akhilkapil