Closed yajuna closed 3 weeks ago
Hi @yajuna -
Thanks for reporting this issue. Can you provide more details about your compute loss function and dummy datasets to reproduce this issue ?
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.
I read the issue 19155 (https://github.com/keras-team/keras/issues/19155), but still have problem
I am trying to perform gradient descent on the model.trainable variables, but have errors regarding model.trainable_variables
Tensorflow version is 2.17.0 keras version is 3.4.1
def get_grad(model, X_train, data_train):
with tf.GradientTape(persistent=True) as tape:
This tape is for derivatives with
g = tape.gradient(loss, model.trainable_variables.value) # del tape
return loss, g
################### Error:
AttributeError: in user code:
File "", line 7, in train_step
loss, grad_theta = get_grad(model, X_train, data_train)
File "", line 6, in get_grad
tape.watch(model.trainable_variables.value)
AttributeError: 'list' object has no attribute 'value'