torch.fx.experimental.proxy_tensor.maybe_enable_thunkify¶
- torch.fx.experimental.proxy_tensor.maybe_enable_thunkify()[source][source]¶
在此上下文管理器中,如果您正在进行 make_fx 跟踪,我们将对所有 SymNode 计算进行 thunkify 处理,并避免将其跟踪到图中,除非实际需要。您应尽量避免使用此功能,因为 SymNode 跟踪的惰性求值可能导致冗长的 thunk 链,在求值时会发生堆栈溢出。然而,目前有时这是必要的,因为 PT2 中存在一些错误的部分,由于 SymNode 计算跟踪不足,会导致出现“s0 is not tracked with proxy”错误。
- 返回类型
Generator[None, None, None] (在 Python v3.13 中)