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

AttributeError: can't set attribute #28108

Closed
SlowMonk opened this issue Apr 24, 2019 · 1 comment
Closed

AttributeError: can't set attribute #28108

SlowMonk opened this issue Apr 24, 2019 · 1 comment

Comments

@SlowMonk
Copy link

'''
Generator
'''
class Generator(tf.keras.Model):
def init(self, input_shape=128):
super(Generator, self).init()

    self.input_shape = input_shape
    self.conv = tf.keras.layers.Conv2D(64,(7,7), padding='same')
    #~ down sampling
    self.down = Downsampling_Part()
    
    
    #ResBlock
    self.res1 = ResBlock(256,(3,3))
    self.res2 = ResBlock(256,(3,3))
    self.res3 = ResBlock(256,(3,3))
    self.res4 = ResBlock(256,(3,3))
    self.res5 = ResBlock(256,(3,3))
    self.res6 = ResBlock(256,(3,3))
    
    # ~Up sampling
    self.upsampleblock = UpSampleBlock()
    
def call(self, images, labels, training):
    # Down - sampling
    x = input_merge(images,labels)
    out = self.down(x);
    
    # Bottleneck
    out = self.res1(out, training=training)
    out = self.res2(out, training=training)
    out = self.res3(out, training=training)
    out = self.res4(out, training=training)
    out = self.res5(out, training=training)
    out = self.res6(out, training=training)
    
    #Up sampling
    out= self.upsampleblock(out)
    
    generated_images =  out
    
    return out

=======================================


AttributeError Traceback (most recent call last)
in ()
----> 1 Gen = Generator()

2 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py in setattr(self, name, value)
1778 # Exclude @property.setters from tracking
1779 hasattr(self.class, name)):
-> 1780 super(Layer, self).setattr(name, value)
1781 return
1782

AttributeError: can't set attribute

@allenlavoie
Copy link
Member

I'm going to add a better error message and close this. The issue is that Model has a @property named input_shape which is read-only.

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

2 participants