SRGAN icon indicating copy to clipboard operation
SRGAN copied to clipboard

AttributeError: 'Model' object has no attribute 'weights'

Open yjlintw opened this issue 6 years ago • 5 comments

When I train the model with the dataset specified in the readme file. I got the following error

Traceback (most recent call last):
  File ".\train.py", line 357, in <module>
    train()
  File ".\train.py", line 102, in train
    grad = tape.gradient(mse_loss, G.weights)
AttributeError: 'Model' object has no attribute 'weights'

Running on Tensorflow 2.0.0 alpha0 Any idea how to fix it?

yjlintw avatar Jun 05 '19 21:06 yjlintw

It seams to work after I change G.weights to G.trainable_weights

yjlintw avatar Jun 05 '19 21:06 yjlintw

Same problem here. There are a few instances that need changing.

PeeJay avatar Jun 25 '19 13:06 PeeJay

Same problem

YYangZiXin avatar Jun 26 '19 07:06 YYangZiXin

It seams to work after I change G.weights to G.trainable_weights

It works perfect for me.

rinabell avatar Aug 03 '19 03:08 rinabell

I update the version of tensorlayer > 2.0.0, and it works.

LaterBetterThanNever avatar Nov 08 '19 05:11 LaterBetterThanNever