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

Function train_step

tests/performance_test/vgg/tf2-autograph.py:39–48  ·  view source on GitHub ↗
(x_batch, y_batch)

Source from the content-addressed store, hash-verified

37# training function
38@tf.function
39def 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

Callers 1

tf2-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…