(X_batch, y_batch)
| 102 | |
| 103 | @tf.function |
| 104 | def train_step(X_batch, y_batch): |
| 105 | with tf.GradientTape() as tape: |
| 106 | _out1, _out2 = model([X_batch[:, 0, :], X_batch[:, 1, :]]) |
| 107 | _loss = contrastive_loss(y_batch, _out1, _out2) |
| 108 | |
| 109 | grad = tape.gradient(_loss, train_weights) |
| 110 | optimizer.apply_gradients(zip(grad, train_weights)) |
| 111 | |
| 112 | _acc = compute_accuracy(y_batch, _out1, _out2) |
| 113 | return _loss, _acc |
| 114 | |
| 115 | |
| 116 | # begin training |
no test coverage detected
searching dependent graphs…