Created
August 10, 2023 16:12
-
-
Save MohanaRC/19541672456ee127f9cb096f9db7e737 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def train_data_for_one_epoch(): | |
""" | |
Function for computing the gradient and updating weights in each epoch. | |
""" | |
losses = [] | |
# Iterate over batches of the dataset and call apply_gradient function | |
for step, (x_batch_train, y_batch_train) in enumerate(train): | |
logits, loss_value = apply_gradient(optimizer, model, x_batch_train, y_batch_train) | |
losses.append(loss_value) | |
train_acc_metric(y_batch_train, logits) | |
return losses |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment