You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read the issue 19155 (#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
# respect to trainable variables
tape.watch(model.trainable_variables.value) ###added .value from issue 19155
loss = compute_loss(model, X_train, data_train)
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'
The text was updated successfully, but these errors were encountered:
I read the issue 19155 (#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
# respect to trainable variables
tape.watch(model.trainable_variables.value) ###added .value from issue 19155
loss = compute_loss(model, X_train, data_train)
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'
The text was updated successfully, but these errors were encountered: