MCPcopy
hub / github.com/tensorlayer/TensorLayer / train_step

Function train_step

tests/performance_test/vgg/tf2-eager.py:38–49  ·  view source on GitHub ↗
(x_batch, y_batch)

Source from the content-addressed store, hash-verified

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

Callers 1

tf2-eager.pyFile · 0.70

Calls 1

gradientMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…