# torch 2.15.0 (BSD-3-Clause), harvested by tools/harvest_corpus.py
=== input

    Registers group forward pre and post-hooks. The pre-hook runs on every
    module pre-forward; downstream state gating ensures one-shot work
    (root setup, post_backward hook registration) fires once per group
    pass. The post-hook runs on every module's post-forward: on the
    partial path (group not yet complete) it applies only the
    ``mp_policy.output_dtype`` cast so standalone per-module callers
    observe the same output dtype semantics as the non-grouped case; on
    the last module it runs the full ``post_hook`` (which reshards,
    registers the pre-backward hook, and itself casts output_dtype). If
    a module never runs forward, the post-hook does not fire for it and
    ``_force_complete_incomplete_states`` finishes the group from the
    root's post-forward.
    
=== parse google
short_description: |
  Registers group forward pre and post-hooks. The pre-hook runs on every
  module pre-forward; downstream state gating ensures one-shot work
  (root setup, post_backward hook registration) fires once per group
  pass. The post-hook runs on every module's post-forward: on the
  partial path (group not yet complete) it applies only the
  ``mp_policy.output_dtype`` cast so standalone per-module callers
  observe the same output dtype semantics as the non-grouped case; on
  the last module it runs the full ``post_hook`` (which reshards,
  registers the pre-backward hook, and itself casts output_dtype). If
  a module never runs forward, the post-hook does not fire for it and
  ``_force_complete_incomplete_states`` finishes the group from the
  root's post-forward.
blank_after_short_description: False
blank_after_long_description: False
style: google
=== detect
rest
=== compose google
Registers group forward pre and post-hooks. The pre-hook runs on every
module pre-forward; downstream state gating ensures one-shot work
(root setup, post_backward hook registration) fires once per group
pass. The post-hook runs on every module's post-forward: on the
partial path (group not yet complete) it applies only the
``mp_policy.output_dtype`` cast so standalone per-module callers
observe the same output dtype semantics as the non-grouped case; on
the last module it runs the full ``post_hook`` (which reshards,
registers the pre-backward hook, and itself casts output_dtype). If
a module never runs forward, the post-hook does not fire for it and
``_force_complete_incomplete_states`` finishes the group from the
root's post-forward.
