File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed
doc/api/training/smp_versions/latest Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,21 @@ TensorFlow API
83
83
with smp.partition(3 ):
84
84
z = tf.reduce_sum(y) # placed in partition 3
85
85
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" )
87
101
88
102
.. class :: smp.CheckpointManager
89
103
@@ -151,18 +165,4 @@ TensorFlow API
151
165
ckpt_manager.restore()
152
166
loss = train_step(inputs)
153
167
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")
168
168
You can’t perform that action at this time.
0 commit comments