评价此页

torch.compiler.is_exporting#

torch.compiler.is_exporting()[源代码]#

指示我们是否正在导出。

这比 is_compiling() 标志更严格,因为它仅在 torch.export 被使用时才设置为 True。

示例

>>> def forward(self, x):
>>>     if not torch.compiler.is_exporting():
>>>        pass # ...logic that is not needed in export...
>>>
>>>     # ...rest of the function...
返回类型

布尔值