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

Function train_step

tests/performance_test/vgg/tl2-static-eager.py:40–50  ·  view source on GitHub ↗
(x_batch, y_batch)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 1

gradientMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…