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

DEC in TensorFlow 1.3; AttributeError: can't set attribute #8

Open
NatLun091238 opened this issue Nov 6, 2017 · 0 comments
Open

DEC in TensorFlow 1.3; AttributeError: can't set attribute #8

NatLun091238 opened this issue Nov 6, 2017 · 0 comments

Comments

@NatLun091238
Copy link

Thank you for posting the code! I attempted to implement your code in TF 1.3 making the following changes:

import tensorflow.contrib.keras.api.keras as K
from tensorflow.contrib.keras.api.keras.initializers import RandomNormal
from tensorflow.contrib.keras.api.keras.layers import Layer, InputSpec
from tensorflow.contrib.keras.api.keras.models import Model, Sequential
from tensorflow.contrib.keras.api.keras.layers import Dense, Dropout, Input
from tensorflow.contrib.keras.api.keras.optimizers import SGD
from tensorflow.contrib.keras.api.keras.callbacks import LearningRateScheduler
from tensorflow.contrib.keras.api.keras.backend import floatx

However, I encounter en error message pointing to line#71, which is the last line in the following:

def build(self, input_shape):
        assert len(input_shape) == 2
        input_dim = input_shape[1]
        self.input_spec = [InputSpec(dtype=K.backend.floatx(),
                                     shape=(None, input_dim))]
        
        self.W = K.backend.variable(self.initial_weights) 
        self.trainable_weights = [self.W]

layerwise pretrain and Finetuning autoencoder works fine on the test example (mnist), but then Initializing cluster centres with k-means. crushes with an error message:

self.trainable_weights = K.backend.variable(self.initial_weights)

AttributeError: can't set attribute

What could be the reason for that??? Thanks in advance.

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

1 participant