strict_fusion¶ class torch.jit.strict_fusion[源代码][源代码]¶ 如果在推理中并非所有节点都已融合,或在训练中并非所有节点都已符号化微分,则报错。 示例:强制加法融合。 @torch.jit.script def foo(x): with torch.jit.strict_fusion(): return x + x + x