Skip to content

Commit c833826

Browse files
author
Ajay P
committed
Updated API doc
1 parent 0035dff commit c833826

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

doc/api/training/smp_versions/latest/smd_model_parallel_tensorflow.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,21 @@ TensorFlow API
8383
    with smp.partition(3):
8484
        z = tf.reduce_sum(y)             # placed in partition 3
8585
86-
86+
87+
.. function:: register_post_partition_hook(hook)
88+
89+
Registers a callable ``hook`` to
90+
be executed after the model is partitioned. This is useful in situations
91+
where an operation needs to be executed after the model partition during
92+
the first call to ``smp.step``, but before the actual execution of the
93+
first forward pass.
94+
95+
.. code:: python
96+
97+
@smp.register_post_partition_hook
98+
def test_eager():
99+
# All statements here will be executed right after partition but before the first forward pass
100+
tf.print("Entered hook through eager context")
87101
88102
.. class:: smp.CheckpointManager
89103

@@ -151,18 +165,4 @@ TensorFlow API
151165
        ckpt_manager.restore()
152166
    loss = train_step(inputs)
153167
154-
.. function:: register_post_partition_hook(hook)
155-
156-
Registers a callable ``hook`` to
157-
be executed after the model is partitioned. This is useful in situations
158-
where an operation needs to be executed after the model partition during
159-
the first call to ``smp.step``, but before the actual execution of the
160-
first forward pass.
161-
162-
.. code:: python
163-
164-
@smp.register_post_partition_hook
165-
def test_eager():
166-
# All statements here will be executed right after partition but before the first forward pass
167-
tf.print("Entered hook through eager context")
168168

0 commit comments

Comments
 (0)