(x_batch, y_batch)
| 37 | # training function |
| 38 | @tf.function |
| 39 | def train_step(x_batch, y_batch): |
| 40 | # forward + backward |
| 41 | with tf.GradientTape() as tape: |
| 42 | ## compute outputs |
| 43 | _logits = vgg(x_batch, training=True) |
| 44 | ## compute loss and update model |
| 45 | _loss = loss_object(y_batch, _logits) |
| 46 | |
| 47 | grad = tape.gradient(_loss, train_weights) |
| 48 | optimizer.apply_gradients(zip(grad, train_weights)) |
| 49 | |
| 50 | |
| 51 | # begin training |
no test coverage detected
searching dependent graphs…