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

Function train_step

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

Source from the content-addressed store, hash-verified

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

Callers 1

tl2-autograph.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…