Skip to content

Commit e2f1913

Browse files
authored
add docstring for fp8_autocast (#3579)
1 parent c010692 commit e2f1913

File tree

1 file changed

+15
-0
lines changed
  • intel_extension_for_pytorch/xpu/fp8

1 file changed

+15
-0
lines changed

intel_extension_for_pytorch/xpu/fp8/fp8.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,21 @@ def fp8_autocast(
115115
enabled: bool = False,
116116
fp8_recipe: Optional[DelayedScaling] = None,
117117
) -> None:
118+
"""
119+
Context manager for FP8 usage.
120+
121+
.. code-block:: python
122+
123+
with fp8_autocast(enabled=True):
124+
out = model(inp)
125+
126+
Parameters
127+
----------
128+
enabled: bool, default = `False`
129+
whether or not to enable fp8
130+
fp8_recipe: recipe.DelayedScaling, default = `None`
131+
recipe used for FP8 training.
132+
"""
118133
global _FP8_ENABLED, _FP8_RECIPE
119134
fp8_state = (_FP8_ENABLED, _FP8_RECIPE)
120135
try:

0 commit comments

Comments
 (0)